:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #7c3aed;
  --accent: #059669;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* Header */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.search-bar {
  flex: 1;
  max-width: 560px;
  position: relative;
}
.search-bar input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 0.9rem;
  background: var(--bg);
  transition: all 0.2s;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-bar .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lighter);
  pointer-events: none;
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-success { background: var(--accent); color: white; }
.btn-danger { background: #dc2626; color: white; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border-light);
  overflow-x: auto;
}
.nav-links a {
  padding: 0.4rem 0.75rem;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { background: rgba(37,99,235,0.08); color: var(--primary); text-decoration: none; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 3rem 0;
  text-align: center;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.2; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 600px; margin: 0 auto 1.5rem; }
.hero-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
}
.hero-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }
.hero-search .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lighter);
}

/* Section */
.section { padding: 2rem 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.section-link { font-size: 0.85rem; font-weight: 600; }

/* App Card */
.app-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.app-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.app-card-icon {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
  overflow: hidden;
}
.app-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card-body { padding: 0.75rem; flex: 1; display: flex; flex-direction: column; }
.app-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-card-meta { font-size: 0.75rem; color: var(--text-light); display: flex; align-items: center; gap: 0.5rem; }
.app-card-rating { color: #f59e0b; font-weight: 600; }
.app-card-size { color: var(--text-lighter); }

/* App Detail */
.app-detail { padding: 2rem 0; }
.app-hero-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 2rem;
}
.app-info-top {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.app-icon-large {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
}
.app-icon-large img { width: 100%; height: 100%; object-fit: cover; }
.app-title-section { flex: 1; }
.app-title-section h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.app-developer { color: var(--text-light); font-size: 0.9rem; margin-bottom: 0.5rem; }
.app-stats-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.app-stat { text-align: center; }
.app-stat-value { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.app-stat-label { font-size: 0.75rem; color: var(--text-lighter); }
.app-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.app-tag {
  background: var(--bg);
  color: var(--text-light);
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}
.download-section { margin-top: 1rem; }
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.download-btn:hover { background: #047857; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.download-info {
  font-size: 0.8rem;
  color: var(--text-lighter);
  margin-top: 0.5rem;
}

.app-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
}
.app-meta-item { }
.app-meta-label { font-size: 0.75rem; color: var(--text-lighter); text-transform: uppercase; letter-spacing: 0.5px; }
.app-meta-value { font-weight: 600; font-size: 0.9rem; }

/* Screenshots */
.screenshots-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem 0;
  -webkit-overflow-scrolling: touch;
}
.screenshot-item {
  width: 200px;
  height: 360px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-lighter);
  font-size: 0.8rem;
}

/* Description sections */
.desc-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.desc-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; }
.desc-section p { color: var(--text-light); line-height: 1.7; }

/* Version history */
.version-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.version-item:last-child { border-bottom: none; }

/* Categories page */
.category-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.category-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; transform: translateY(-2px); }
.category-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.category-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.category-count { font-size: 0.8rem; color: var(--text-lighter); }

/* Trust bar */
.trust-bar {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}
.trust-items { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 1rem; text-align: center; }
.trust-item { }
.trust-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.trust-text { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.trust-sub { font-size: 0.75rem; color: var(--text-lighter); }

/* Filter bar */
.filter-bar {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.filter-bar select, .filter-bar input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--primary); }

/* Search results */
.search-page { padding: 2rem 0; }
.search-results-count { color: var(--text-light); margin-bottom: 1rem; font-size: 0.9rem; }
.search-highlight { background: #fef3c7; padding: 0.1rem 0.3rem; border-radius: 3px; }

/* Legal pages */
.legal-page { padding: 3rem 0; }
.legal-page h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
.legal-page h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
.legal-page p, .legal-page li { color: var(--text-light); margin-bottom: 0.75rem; line-height: 1.7; }
.legal-page ul { padding-left: 1.5rem; }

/* Contact page */
.contact-form { max-width: 600px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { min-height: 120px; resize: vertical; }

/* Footer */
.site-footer {
  background: #1e293b;
  color: #cbd5e1;
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand h3 { color: white; font-size: 1.25rem; margin-bottom: 0.5rem; }
.footer-brand p { font-size: 0.85rem; line-height: 1.6; }
.footer-col h4 { color: white; font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-col a { display: block; color: #94a3b8; font-size: 0.85rem; padding: 0.2rem 0; transition: color 0.15s; }
.footer-col a:hover { color: white; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Login page */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 60vh; padding: 2rem; }
.login-box { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-box h1 { font-size: 1.5rem; text-align: center; margin-bottom: 0.5rem; }
.login-box .subtitle { text-align: center; color: var(--text-light); font-size: 0.85rem; margin-bottom: 1.5rem; }
.login-error { background: #fef2f2; color: #dc2626; padding: 0.75rem; border-radius: 6px; font-size: 0.85rem; margin-bottom: 1rem; display: none; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.85rem; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin: 2rem 0; }
.pagination button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badge */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-featured { background: #fef3c7; color: #92400e; }
.badge-trending { background: #fce7f3; color: #9d174d; }
.badge-new { background: #dcfce7; color: #166534; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-published { background: #dcfce7; color: #166534; }

/* Admin styles */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 250px;
  background: #1e293b;
  color: white;
  padding: 1.5rem 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .logo { color: white; padding: 0 1.5rem; margin-bottom: 1.5rem; font-size: 1.25rem; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}
.admin-nav a:hover { background: rgba(255,255,255,0.05); color: white; text-decoration: none; }
.admin-nav a.active { background: rgba(37,99,235,0.2); color: #60a5fa; border-right: 3px solid #60a5fa; }
.admin-nav .nav-section { padding: 0.75rem 1.5rem 0.25rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: #475569; font-weight: 700; }
.admin-content { flex: 1; padding: 1.5rem; overflow-x: auto; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.admin-header h1 { font-size: 1.5rem; font-weight: 700; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card-label { font-size: 0.8rem; color: var(--text-lighter); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card-value { font-size: 1.75rem; font-weight: 800; color: var(--text); margin: 0.25rem 0; }
.stat-card-sub { font-size: 0.8rem; color: var(--text-light); }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th {
  background: var(--bg);
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.admin-table tr:hover td { background: rgba(37,99,235,0.02); }
.admin-table .app-cell { display: flex; align-items: center; gap: 0.75rem; }
.admin-table .app-cell-icon { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.admin-table .app-cell-icon img { width: 100%; height: 100%; object-fit: cover; }
.actions-cell { display: flex; gap: 0.4rem; }

/* Card */
.card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.95rem; }
.card-body { padding: 1.25rem; }

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.3s;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(0); }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem; color: var(--text-lighter); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 0.5rem; }

/* Loading */
.loading { text-align: center; padding: 3rem; color: var(--text-lighter); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile nav toggle */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); padding: 0.25rem; }
.mobile-nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text); padding: 0.35rem; line-height: 1; }
.mobile-nav-overlay { display: none; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 0; font-size: 0.85rem; color: var(--text-lighter); }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Mobile Nav Overlay ===== */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.mobile-nav-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Responsive — Tablet (≤1024px) ===== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-6 { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .app-hero-section { padding: 1.5rem; }
  .app-meta-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ===== Responsive — Mobile (≤768px) ===== */
@media (max-width: 768px) {
  /* Grids */
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }

  /* Container */
  .container { padding: 0 0.85rem; }

  /* ---- Header / Nav ---- */
  .header-top { flex-wrap: wrap; gap: 0.6rem; }
  .logo { font-size: 1.25rem; }
  .logo-icon { width: 32px; height: 32px; font-size: 0.95rem; }
  .search-bar { order: 3; flex-basis: 100%; max-width: 100%; }
  .search-bar input { padding: 0.5rem 0.85rem 0.5rem 2.2rem; font-size: 0.85rem; }
  .header-actions .btn { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

  /* Mobile nav */
  .mobile-nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    flex-direction: column;
    background: var(--bg-white);
    padding: 4rem 1rem 1.5rem;
    gap: 0;
    z-index: 160;
    box-shadow: -2px 0 12px rgba(0,0,0,0.12);
    transition: right 0.3s ease;
    border-top: none;
    overflow-y: auto;
  }
  .nav-links.open { right: 0; }
  .nav-links a {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-light);
  }
  .nav-links a:last-child { border-bottom: none; }

  /* ---- Hero ---- */
  .hero { padding: 1.75rem 0; }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.88rem; }
  .hero-search input { padding: 0.75rem 1rem 0.75rem 2.5rem; font-size: 0.9rem; }

  /* ---- Section ---- */
  .section { padding: 1.25rem 0; }
  .section-title { font-size: 1.15rem; }

  /* ---- App Cards ---- */
  .app-card-icon { font-size: 2.25rem; }
  .app-card-body { padding: 0.6rem; }
  .app-card-title { font-size: 0.8rem; }

  /* ---- App Detail / Download Page ---- */
  .app-detail { padding: 1rem 0 2rem; }
  .app-hero-section {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
  }
  .app-info-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }
  .app-icon-large {
    width: 96px;
    height: 96px;
    border-radius: 20px;
    font-size: 2.5rem;
  }
  .app-title-section { width: 100%; }
  .app-title-section h1 { font-size: 1.25rem; }
  .app-developer { font-size: 0.82rem; }
  .app-title-section > div[style*="display:flex"][style*="gap:0.5rem"] { justify-content: center; }
  .app-stats-row {
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
  }
  .app-stat-value { font-size: 0.95rem; }
  .app-stat-label { font-size: 0.7rem; }
  .app-tags { justify-content: center; }

  .download-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .download-btn {
    width: 100%;
    justify-content: center;
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 12px;
  }
  .download-info { text-align: center; font-size: 0.75rem; }

  /* App meta grid */
  .app-meta-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
  }
  .app-meta-label { font-size: 0.68rem; }
  .app-meta-value { font-size: 0.82rem; }

  /* Screenshots */
  .screenshots-scroll { gap: 0.65rem; }
  .screenshot-item {
    width: 150px;
    height: 270px;
    border-radius: var(--radius-sm);
  }

  /* Description sections */
  .desc-section {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
  }
  .desc-section h2 { font-size: 1.05rem; }
  .desc-section p { font-size: 0.88rem; }

  /* Version history */
  .version-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.65rem 0;
  }

  /* Safety box */
  .safety-box {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
  }
  .safety-icon { font-size: 1.3rem; }
  .safety-content h3 { font-size: 0.9rem; }
  .safety-content p { font-size: 0.82rem; }

  /* ---- Category Cards ---- */
  .category-card { padding: 1rem; }
  .category-icon { font-size: 2rem; }
  .category-name { font-size: 0.88rem; }

  /* ---- Trust Bar ---- */
  .trust-bar { padding: 1rem; margin: 1rem 0; }
  .trust-items { gap: 0.75rem; }
  .trust-item { flex: 1; min-width: 120px; }
  .trust-icon { font-size: 1.5rem; }
  .trust-text { font-size: 0.78rem; }
  .trust-sub { font-size: 0.68rem; }

  /* ---- Filter Bar ---- */
  .filter-bar { flex-direction: column; padding: 0.75rem; }
  .filter-bar select, .filter-bar input, .filter-bar button { width: 100%; }

  /* ---- Footer ---- */
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-brand h3 { font-size: 1.1rem; }
  .footer-brand p { font-size: 0.82rem; }
  .footer-col h4 { font-size: 0.82rem; }
  .footer-col a { font-size: 0.82rem; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
    font-size: 0.75rem;
  }

  /* ---- Login ---- */
  .login-page { padding: 1.5rem 1rem; min-height: auto; }
  .login-box { padding: 1.5rem; }
  .login-box h1 { font-size: 1.25rem; }

  /* ---- Forms / Contact ---- */
  .contact-form { max-width: 100%; }
  .form-group { margin-bottom: 0.85rem; }
  .form-group input, .form-group textarea, .form-group select {
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
  }

  /* ---- Legal Pages ---- */
  .legal-page { padding: 1.5rem 0; }
  .legal-page h1 { font-size: 1.35rem; }
  .legal-page h2 { font-size: 1.05rem; }

  /* ---- Admin ---- */
  .admin-sidebar { display: none; }
  .admin-sidebar.open {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 260px;
    height: 100vh;
  }
  .mobile-menu-btn { display: block; font-size: 1.3rem; }
  .admin-content { padding: 1rem; }
  .admin-header h1 { font-size: 1.25rem; }

  /* Admin table — horizontal scroll */
  .admin-table { min-width: 580px; }
  .admin-table th, .admin-table td { padding: 0.5rem 0.65rem; font-size: 0.78rem; }
  .actions-cell { flex-wrap: wrap; }
  .actions-cell .btn { font-size: 0.7rem; padding: 0.25rem 0.5rem; }

  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat-card { padding: 1rem; }
  .stat-card-value { font-size: 1.4rem; }

  /* Cards */
  .card-header { padding: 0.85rem 1rem; font-size: 0.88rem; }
  .card-body { padding: 1rem; }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab { padding: 0.5rem 0.85rem; font-size: 0.78rem; white-space: nowrap; }

  /* Breadcrumb */
  .breadcrumb { font-size: 0.78rem; padding: 0.5rem 0; }

  /* Toast */
  .toast { left: 1rem; right: 1rem; text-align: center; font-size: 0.82rem; }
}

/* ===== Responsive — Small Mobile (≤480px) ===== */
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }

  .hero h1 { font-size: 1.2rem; }
  .hero p { font-size: 0.82rem; }
  .hero-search input { padding: 0.7rem 0.85rem 0.7rem 2.2rem; font-size: 0.85rem; }

  /* App detail compact */
  .app-icon-large { width: 80px; height: 80px; border-radius: 16px; }
  .app-title-section h1 { font-size: 1.1rem; }
  .app-stats-row { gap: 0.75rem; }
  .app-stat-value { font-size: 0.85rem; }
  .download-btn { padding: 0.8rem 1.25rem; font-size: 0.9rem; }

  .app-meta-grid { grid-template-columns: 1fr 1fr; padding: 0.85rem; }

  .screenshot-item { width: 130px; height: 230px; }

  /* Category cards */
  .category-card { padding: 0.85rem; }
  .category-icon { font-size: 1.75rem; }

  /* Trust bar */
  .trust-items { flex-direction: column; gap: 0.6rem; }
  .trust-item { display: flex; align-items: center; gap: 0.75rem; text-align: left; }
  .trust-icon { margin-bottom: 0; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr; }

  /* Admin table */
  .admin-table { min-width: 480px; }
}

/* Safety section */
.safety-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.safety-icon { font-size: 1.5rem; flex-shrink: 0; }
.safety-content h3 { font-size: 0.95rem; color: #166534; margin-bottom: 0.3rem; }
.safety-content p { font-size: 0.85rem; color: #15803d; }

/* Hide elements */
.hidden { display: none !important; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > main { flex: 1; }
