:root {
  --ps-green: #01875f;
  --ps-green-dark: #016e4d;
  --ps-green-light: #1db954;
  --ps-bg: #f8f9fa;
  --ps-white: #ffffff;
  --ps-text: #202124;
  --ps-text-secondary: #5f6368;
  --ps-border: #e8eaed;
  --ps-shadow: 0 1px 3px rgba(0,0,0,0.12);
  --ps-shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
  --ps-radius: 16px;
  --ps-radius-sm: 8px;
  --ps-font: 'Google Sans', 'Roboto', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--ps-font);
  background: var(--ps-bg);
  color: var(--ps-text);
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.ps-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ps-white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.ps-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.ps-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.ps-logo-icon { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.ps-logo-text {
  font-size: 20px;
  font-weight: 500;
  color: var(--ps-text);
  white-space: nowrap;
}
.ps-search {
  flex: 1;
  max-width: 600px;
  position: relative;
}
.ps-search-input {
  width: 100%;
  padding: 10px 16px 10px 44px;
  border: none;
  border-radius: 24px;
  background: #f1f3f4;
  font-size: 15px;
  font-family: var(--ps-font);
  outline: none;
  transition: background 0.2s, box-shadow 0.2s;
}
.ps-search-input:focus {
  background: var(--ps-white);
  box-shadow: 0 1px 6px rgba(32,33,36,0.12);
}
.ps-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ps-text-secondary);
  font-size: 18px;
  pointer-events: none;
}

/* Categories */
.ps-categories {
  background: var(--ps-white);
  border-bottom: 1px solid var(--ps-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ps-categories::-webkit-scrollbar { display: none; }
.ps-categories-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.ps-category {
  padding: 6px 18px;
  border: 1px solid var(--ps-border);
  border-radius: 20px;
  background: var(--ps-white);
  font-size: 14px;
  font-family: var(--ps-font);
  color: var(--ps-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  flex-shrink: 0;
}
.ps-category:hover { background: #f1f3f4; }
.ps-category.active {
  background: #e8f5e9;
  color: var(--ps-green);
  border-color: var(--ps-green);
  font-weight: 500;
}

/* Banner */
.ps-banner {
  position: relative;
  border-radius: var(--ps-radius);
  margin: 16px auto;
  max-width: 1168px;
  height: 240px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.ps-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
  display: flex;
  align-items: flex-end;
  padding: 32px;
}
.ps-banner-content { color: white; }
.ps-banner-title { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.ps-banner-category { font-size: 14px; opacity: 0.9; display: block; margin-bottom: 12px; }

/* Sections */
.ps-sections {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.ps-section { margin-bottom: 32px; }
.ps-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.ps-section-title { font-size: 20px; font-weight: 500; }

/* Apps Row */
.ps-apps-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.ps-apps-row::-webkit-scrollbar { height: 4px; }
.ps-apps-row::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.ps-apps-row::-webkit-scrollbar-track { background: transparent; }

/* App Card */
.ps-app-card {
  min-width: 180px;
  max-width: 180px;
  background: var(--ps-white);
  border-radius: var(--ps-radius-sm);
  padding: 16px 12px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  scroll-snap-align: start;
  border: 1px solid var(--ps-border);
}
.ps-app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ps-shadow-hover);
}
.ps-app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.ps-app-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-app-cat {
  font-size: 12px;
  color: var(--ps-text-secondary);
  display: block;
  margin: 2px 0 6px;
}

/* Buttons */
.ps-btn {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 20px;
  font-family: var(--ps-font);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.ps-btn-primary {
  background: var(--ps-white);
  color: var(--ps-green);
}
.ps-btn-primary:hover { background: #f1f3f4; }
.ps-btn-install {
  background: #e8f5e9;
  color: var(--ps-green);
  font-size: 13px;
  padding: 4px 16px;
  width: 100%;
  margin-top: 8px;
  border-radius: 20px;
  display: inline-block;
  text-decoration: none;
  transition: background 0.2s;
}
.ps-btn-install:hover { background: #c8e6c9; }

/* Stars */
.ps-stars {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-bottom: 8px;
}
.ps-star { color: #dadce0; font-size: 16px; line-height: 1; }
.ps-star.filled { color: #fbbc04; }

/* Modal */
.ps-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.ps-modal.open { display: flex; }
.ps-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.ps-modal-content {
  position: relative;
  background: var(--ps-white);
  border-radius: var(--ps-radius);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.ps-modal-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
}
.ps-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--ps-text-secondary);
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.ps-modal-close:hover { background: #f1f3f4; }
.ps-modal-body { padding: 0 16px 24px; }
.ps-modal-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  object-fit: cover;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.ps-modal-name { text-align: center; font-size: 22px; font-weight: 500; }
.ps-modal-category {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--ps-text-secondary);
  margin-bottom: 8px;
}
.ps-modal-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ps-text-secondary);
  margin: 12px 0;
  padding: 0 8px;
  text-align: center;
}
.ps-modal-downloads {
  text-align: center;
  font-size: 13px;
  color: var(--ps-text-secondary);
  margin-bottom: 16px;
}
.ps-modal-install {
  display: block;
  text-align: center;
  padding: 12px;
  background: var(--ps-green);
  color: white;
  border-radius: 24px;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: background 0.2s;
}
.ps-modal-install:hover { background: var(--ps-green-dark); }

/* Search Results */
.ps-search-results {
  display: none;
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}
.ps-search-results.open { display: block; }
.ps-search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.ps-search-results .ps-app-card {
  min-width: unset;
  max-width: unset;
}

/* Empty state */
.ps-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--ps-text-secondary);
}
.ps-empty-icon { font-size: 48px; margin-bottom: 12px; }
.ps-empty-text { font-size: 16px; }

/* Footer */
.ps-footer {
  text-align: center;
  padding: 24px;
  color: var(--ps-text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--ps-border);
  margin-top: 32px;
}

/* Responsive */
@media (max-width: 640px) {
  .ps-header-inner { padding: 8px 12px; gap: 8px; }
  .ps-logo-text { display: none; }
  .ps-search { max-width: 100%; }
  .ps-banner { height: 180px; margin: 12px; border-radius: 12px; }
  .ps-banner-overlay { padding: 20px; }
  .ps-banner-title { font-size: 20px; }
  .ps-app-card { min-width: 150px; max-width: 150px; }
  .ps-app-icon { width: 64px; height: 64px; }
  .ps-modal-content { width: 95%; border-radius: 12px; }
}