* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f2f4f7; color: #333; }
.header { background: #1c1d22; color: #fff; text-align: center; padding: 20px; border-bottom: 4px solid #ff4757; }
.logo { font-size: 2rem; font-weight: bold; }
.logo span {
  color: #2ed573;
  font-style: italic;
}
.version { font-size: 0.8rem; color: #888; }
.main-layout { max-width: 900px; margin: 20px auto; padding: 0 15px; }

/* Chart Navigation Header */
.chart-header { background: #fff; padding: 15px 20px; border-radius: 8px 8px 0 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; flex-wrap: wrap; gap: 12px; }
.controls-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.genre-dropdown { padding: 8px 12px; border-radius: 8px; border: 1px solid #ddd; background: #f0f2f5; font-weight: 600; font-size: 0.85rem; color: #444; outline: none; cursor: pointer; }
.genre-dropdown:focus { border-color: #ff4757; }

.tab-buttons { display: flex; gap: 6px; background: #f0f2f5; padding: 4px; border-radius: 8px; }
.tab-btn { background: none; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: 0.85rem; cursor: pointer; color: #666; transition: all 0.2s; }
.tab-btn.active { background: #ff4757; color: #fff; box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3); }

.app-grid { background: #fff; padding: 20px; border-radius: 0 0 8px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; min-height: 250px; }
.app-card { border: 1px solid #eee; padding: 12px; border-radius: 8px; text-align: center; display: flex; flex-direction: column; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.app-card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.08); }
.app-icon { width: 64px; height: 64px; border-radius: 12px; margin: 0 auto 10px; }
.dev { font-size: 0.8rem; color: #666; margin-bottom: 8px; }

/* Truncated Summary with Line Clamping */
.summary {
  font-size: 0.75rem;
  color: #555;
  line-height: 1.35;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.7em;
}

.btn { background: #2ed573; color: #fff; border: none; padding: 6px 12px; border-radius: 4px; font-weight: bold; margin-top: auto; font-size: 0.8rem; cursor: pointer; }

/* Modal Styles */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal-content { background: #fff; width: 100%; max-width: 700px; max-height: 85vh; overflow-y: auto; border-radius: 12px; padding: 25px; position: relative; }
.close-btn { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: #888; }
.modal-header { display: flex; gap: 20px; margin-bottom: 20px; align-items: center; }
.modal-app-icon { width: 90px; height: 90px; border-radius: 18px; }
.modal-title { font-size: 1.4rem; margin-bottom: 4px; }
.modal-dev { font-size: 0.9rem; color: #666; margin-bottom: 6px; }
.genre { color: #ff4757; font-weight: 500; }
.rating { font-size: 0.85rem; color: #444; margin-bottom: 10px; }
.get-btn { display: inline-block; background: #2ed573; color: #fff; text-decoration: none; padding: 8px 16px; border-radius: 6px; font-weight: bold; font-size: 0.9rem; }

/* Screenshot Scroll View */
.screenshots-gallery { display: flex; gap: 12px; overflow-x: auto; padding: 10px 0 15px; margin-bottom: 20px; scrollbar-width: thin; }
.screenshot-img { height: 260px; border-radius: 8px; border: 1px solid #ddd; flex-shrink: 0; }
.description-text { font-size: 0.9rem; line-height: 1.6; color: #444; background: #f8f9fa; padding: 15px; border-radius: 8px; }
.loading { text-align: center; padding: 40px; color: #777; grid-column: 1 / -1; }