:root {
    color-scheme: light;
    --bg: #f5f6fb;
    --surface: #fff;
    --surface-soft: #f8f8fc;
    --text: #17162a;
    --muted: #6d7084;
    --line: #e5e6ef;
    --primary: #5b4fd8;
    --primary-dark: #4438b8;
    --danger: #b42318;
    --success: #157347;
    --shadow: 0 18px 52px rgba(31, 26, 79, .12);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 8% 32%, rgba(91,79,216,.08), transparent 28rem), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.hero { position: relative; overflow: hidden; min-height: 450px; padding: 65px 22px 112px; color: white; background: linear-gradient(135deg, #171332, #493b9d); }
.hero-orb { position: absolute; border-radius: 50%; filter: blur(10px); opacity: .42; pointer-events: none; }
.hero-orb-a { width: 430px; height: 430px; top: -260px; left: -100px; background: #a692ff; }
.hero-orb-b { width: 370px; height: 370px; right: -120px; bottom: -240px; background: #68d9ff; }
.hero-content { position: relative; z-index: 1; width: min(850px, 100%); margin: auto; text-align: center; }
.brand-mark { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 20px; color: #302664; border-radius: 22px; background: linear-gradient(145deg, white, #dcd7ff); box-shadow: 0 18px 45px rgba(8,6,27,.35); }
.brand-mark svg { width: 39px; height: 39px; }
.eyebrow, .section-kicker { margin: 0; color: #c9c0ff; font-size: .76rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 12px 0 16px; font-size: clamp(2.5rem, 7vw, 4.6rem); line-height: 1; letter-spacing: -.055em; }
.hero-description { max-width: 710px; margin: auto; color: rgba(255,255,255,.8); font-size: clamp(1rem,2vw,1.18rem); line-height: 1.7; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 29px; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 21px; border-radius: 14px; font-weight: 750; text-decoration: none; transition: transform .16s, background .16s; }
.primary-action { color: #292348; background: white; box-shadow: 0 12px 30px rgba(8,6,27,.25); }
.secondary-action { color: white; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.primary-action:hover, .secondary-action:hover { transform: translateY(-2px); }
.secondary-action:hover { background: rgba(255,255,255,.15); }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 27px; }
.trust-row span { padding: 7px 11px; color: rgba(255,255,255,.76); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(255,255,255,.06); font-size: .78rem; }

.page-shell { position: relative; z-index: 2; width: min(1240px, calc(100% - 32px)); margin: -68px auto 0; }
.search-panel { padding: 29px; border: 1px solid rgba(229,230,239,.9); border-radius: 25px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.search-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.search-heading .section-kicker { color: var(--primary); }
.search-heading h2 { margin: 5px 0 0; font-size: clamp(1.5rem,3vw,2rem); letter-spacing: -.035em; }
.api-status { padding: 7px 11px; border-radius: 999px; color: var(--muted); background: #f0f1f6; font-size: .82rem; font-weight: 700; }
.api-status[data-kind="ok"] { color: var(--success); background: #e9f7ef; }
.api-status[data-kind="error"] { color: var(--danger); background: #fff0ee; }
.api-status[data-kind="loading"] { color: #7a5b00; background: #fff7d6; }
.search-control { position: relative; }
.search-control input { width: 100%; height: 62px; padding: 0 52px; color: var(--text); border: 1px solid #d9dbe7; border-radius: 17px; outline: 0; background: white; box-shadow: 0 8px 22px rgba(34,29,77,.05); transition: border-color .16s, box-shadow .16s; }
.search-control input:focus { border-color: #9184f4; box-shadow: 0 0 0 4px rgba(91,79,216,.12), 0 10px 28px rgba(34,29,77,.08); }
.search-icon { position: absolute; z-index: 2; top: 50%; left: 18px; width: 22px; height: 22px; color: var(--primary); transform: translateY(-50%); pointer-events: none; }
.clear-search { position: absolute; z-index: 3; top: 50%; right: 15px; width: 32px; height: 32px; padding: 0; color: #999cac; border: 0; border-radius: 50%; background: transparent; font-size: 25px; line-height: 1; transform: translateY(-50%); cursor: pointer; }
.clear-search:hover { color: var(--primary); background: #f1efff; }
.suggestions { position: absolute; z-index: 20; top: calc(100% + 7px); right: 0; left: 0; overflow: hidden; padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 18px 40px rgba(31,26,79,.16); }
.suggestions button { display: block; width: 100%; padding: 11px 13px; color: var(--text); border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.suggestions button:hover { background: #f1efff; }
.search-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 11px; color: var(--muted); font-size: .84rem; }
.search-footer p { flex: 1 1 auto; margin: 0; }
.search-examples { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.example-chip { padding: 6px 10px; color: var(--primary); border: 1px solid #dcd8ff; border-radius: 999px; background: #f3f1ff; white-space: nowrap; cursor: pointer; }

.results-section { min-height: 290px; padding: 34px 0 70px; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; }
.empty-state, .loading-state, .error-state { grid-column: 1 / -1; display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: 250px; padding: 35px; text-align: center; color: var(--muted); border: 1px dashed #d4d5e2; border-radius: 24px; background: rgba(255,255,255,.6); }
.empty-state-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 14px; color: var(--primary); border-radius: 18px; background: #ece9ff; font-weight: 900; }
.empty-state h3, .error-state strong { margin: 0 0 7px; color: var(--text); font-size: 1.15rem; }
.empty-state p, .error-state p { max-width: 560px; margin: 0; line-height: 1.6; }
.error-state { color: var(--danger); border-color: #efc8c3; background: #fff8f7; }
.error-state button { margin-top: 15px; padding: 9px 15px; color: white; border: 0; border-radius: 10px; background: var(--primary); cursor: pointer; }
.spinner { width: 25px; height: 25px; margin: 0 0 12px; border: 3px solid #ddd9ff; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-card { display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 12px 30px rgba(37,31,85,.08); transition: transform .18s, box-shadow .18s, border-color .18s; }
.app-card:hover { border-color: #d3cff5; transform: translateY(-4px); box-shadow: 0 20px 42px rgba(37,31,85,.13); }
.app-card-head { display: flex; gap: 14px; min-width: 0; }
.app-icon { flex: 0 0 auto; width: 72px; height: 72px; border-radius: 17px; object-fit: cover; background: #f1efff; }
.app-icon-placeholder { display: grid; place-items: center; color: var(--primary); font-weight: 900; }
.app-title-wrap { min-width: 0; }
.app-title-wrap h3 { overflow: hidden; margin: 1px 0 5px; font-size: 1.15rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.package-copy { display: block; overflow: hidden; max-width: 100%; padding: 0; color: var(--muted); border: 0; background: none; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; cursor: copy; }
.rating-row { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 8px; font-size: .78rem; }
.rating-row small { color: var(--muted); }
.stars { color: #f2b727; letter-spacing: -.04em; }
.app-description { display: -webkit-box; min-height: 3.15em; overflow: hidden; margin: 17px 0; color: #55586d; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.app-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0 0 18px; padding: 14px; border-radius: 15px; background: var(--surface-soft); }
.app-meta div { min-width: 0; }
.app-meta dt { color: var(--muted); font-size: .72rem; }
.app-meta dd { overflow: hidden; margin: 3px 0 0; font-size: .85rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.app-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.download-btn { padding: 9px 15px; color: white; border: 0; border-radius: 10px; background: var(--primary); box-shadow: 0 8px 18px rgba(91,79,216,.22); cursor: pointer; }
.download-btn:hover { background: var(--primary-dark); }
.text-action { padding: 0; color: var(--primary); border: 0; background: transparent; font-size: .8rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.text-action:hover { text-decoration: underline; }
.load-more { display: block; margin: 28px auto 0; padding: 11px 22px; color: var(--primary); border: 1px solid #cbc5f5; border-radius: 12px; background: white; font-weight: 750; cursor: pointer; }

