:root {
  --bg: #080b14;
  --bg2: #0e1424;
  --card: rgba(18, 25, 43, .74);
  --card-hover: rgba(25, 34, 57, .94);
  --text: #f5f7fb;
  --muted: #97a0b5;
  --line: rgba(255,255,255,.09);
  --accent: #7c5cff;
  --accent2: #24c8ff;
  --good: #7ee7b0;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 50% -20%, #19244a 0, var(--bg) 48%, #05070c 100%);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; position: relative; z-index: 2; }
.bg-orb { position: fixed; border-radius: 999px; filter: blur(90px); opacity: .16; pointer-events: none; }
.orb-1 { width: 360px; height: 360px; background: #725cff; top: 8%; left: -160px; }
.orb-2 { width: 420px; height: 420px; background: #18bff5; right: -220px; top: 34%; }

.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(8,11,20,.72); backdrop-filter: blur(20px); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-icon { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--bg2); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.brand > div { min-width: 0; }
.brand strong { display: block; font-size: 15px; letter-spacing: .01em; }
.brand span { display: block; max-width: min(58vw, 620px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.source-link { color: #c9cfff; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: rgba(255,255,255,.035); }

.hero { padding: 76px 0 34px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: #a9b6ff; letter-spacing: .24em; font-size: 12px; font-weight: 800; }
.hero h1 { margin: 0; font-size: clamp(42px, 8vw, 82px); line-height: .98; letter-spacing: -.055em; }
.hero h1 span { background: linear-gradient(100deg, #c9bfff, #6de1ff); -webkit-background-clip: text; color: transparent; }
.hero-copy { max-width: 650px; margin: 22px auto 30px; color: var(--muted); font-size: 16px; }
.hero code { color: #d8ddff; }
.search-wrap { max-width: 760px; margin: 0 auto; height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; background: rgba(15,21,36,.82); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.search-wrap:focus-within { border-color: rgba(124,92,255,.75); box-shadow: 0 0 0 4px rgba(124,92,255,.12), var(--shadow); }
.search-wrap svg { width: 23px; height: 23px; fill: none; stroke: #8590a7; stroke-width: 1.8; flex: 0 0 auto; }
.search-wrap input { flex: 1; width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 17px; }
.search-wrap input::placeholder { color: #697388; }
.clear-btn { border: 0; background: transparent; color: #7f899f; font-size: 29px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.stats { margin: 26px auto 0; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.stats div { min-width: 128px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.stats b { display: block; font-size: 20px; }
.stats span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0 22px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip, select { border: 1px solid var(--line); background: rgba(255,255,255,.035); color: #bec6d8; border-radius: 999px; padding: 9px 13px; cursor: pointer; outline: 0; }
.chip.active { background: #f3f5ff; color: #101321; border-color: transparent; font-weight: 750; }
select { appearance: none; border-radius: 13px; padding-right: 14px; }
.status { color: var(--muted); text-align: center; padding: 30px 0; }

.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 26px 0; }
.app-card { position: relative; display: grid; grid-template-columns: 74px minmax(0,1fr); gap: 16px; min-height: 190px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(150deg, rgba(255,255,255,.055), rgba(255,255,255,.02)); box-shadow: 0 12px 34px rgba(0,0,0,.14); overflow: hidden; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.app-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.17); background: var(--card-hover); }
.card-open { position: absolute; inset: 0; z-index: 1; border: 0; background: transparent; cursor: pointer; }
.app-icon { width: 74px; height: 74px; object-fit: cover; border-radius: 18px; background: #151b2a; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 9px 24px rgba(0,0,0,.28); }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.type-pill { font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #b8bfff; }
.type-pill.game { color: var(--good); }
.version { color: #788399; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-name { margin: 5px 0 2px; font-size: 18px; line-height: 1.25; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bundle-id { margin: 0; color: #7f8aa1; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.description { margin: 11px 0 12px; color: #a8b0c1; font-size: 12px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #7f899c; font-size: 11px; }
.details-hint { color: #bac2ff; }
.load-more-wrap { text-align: center; padding: 2px 0 64px; }
.load-more { border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(255,255,255,.05); color: #e9ecf7; padding: 12px 20px; cursor: pointer; }
.load-more:hover { background: rgba(255,255,255,.09); }
.empty { grid-column: 1 / -1; padding: 60px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

.app-dialog { width: min(700px, calc(100% - 24px)); max-height: min(86vh, 820px); border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: #101625; color: var(--text); padding: 0; box-shadow: 0 30px 100px rgba(0,0,0,.62); }
.app-dialog::backdrop { background: rgba(2,4,9,.72); backdrop-filter: blur(9px); }
.dialog-card { position: relative; padding: 26px; overflow: auto; max-height: inherit; }
.dialog-close { position: absolute; right: 18px; top: 16px; z-index: 2; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.055); color: #c5ccda; font-size: 25px; cursor: pointer; }
.dialog-head { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 18px; align-items: center; padding-right: 42px; }
.dialog-icon { width: 88px; height: 88px; object-fit: cover; border-radius: 22px; background: #161d2c; border: 1px solid var(--line); }
.dialog-type { margin: 0 0 4px; color: #aeb5ff; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dialog-head h2 { margin: 0; font-size: clamp(24px, 5vw, 34px); line-height: 1.05; letter-spacing: -.04em; }
.dialog-meta { margin: 7px 0 0; color: var(--muted); }
.dialog-info { margin: 24px 0; display: grid; grid-template-columns: 1.6fr .7fr .7fr; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.dialog-info > div { min-width: 0; padding: 13px 14px; background: rgba(255,255,255,.025); }
.dialog-info > div + div { border-left: 1px solid var(--line); }
.dialog-info span { display: block; color: #788398; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.dialog-info code, .dialog-info strong { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e9ecf8; font-size: 12px; }
.dialog-description { margin: 0; color: #bac1d0; white-space: pre-wrap; max-height: 34vh; overflow: auto; padding-right: 4px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 24px; }
.dialog-actions > * { flex: 1; text-align: center; text-decoration: none; border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.secondary-btn { border: 1px solid var(--line); background: rgba(255,255,255,.04); color: #d8ddeb; }
.primary-btn { border: 1px solid transparent; background: linear-gradient(100deg, #735cff, #45b8ff); color: white; font-weight: 800; }

@media (max-width: 920px) { .app-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 620px) {
  .shell { width: min(100% - 22px, 1180px); }
  .site-header { position: relative; }
  .header-inner { min-height: 68px; }
  .brand span { max-width: 56vw; }
  .source-link { display: none; }
  .hero { padding-top: 52px; }
  .hero h1 { font-size: 48px; }
  .hero-copy { font-size: 14px; }
  .search-wrap { height: 57px; border-radius: 17px; }
  .stats { gap: 7px; }
  .stats div { min-width: 104px; padding: 9px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .chips { flex-wrap: nowrap; }
  .chip { flex: 1; }
  select { width: 100%; }
  .app-grid { grid-template-columns: 1fr; padding-top: 18px; }
  .app-card { min-height: 166px; grid-template-columns: 64px minmax(0,1fr); padding: 15px; }
  .app-icon { width: 64px; height: 64px; border-radius: 16px; }
  .description { -webkit-line-clamp: 2; }
  .dialog-card { padding: 20px; }
  .dialog-head { grid-template-columns: 72px minmax(0,1fr); gap: 14px; }
  .dialog-icon { width: 72px; height: 72px; border-radius: 18px; }
  .dialog-info { grid-template-columns: 1fr 1fr; }
  .dialog-info > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .dialog-info > div:nth-child(2) { border-left: 0; }
  .dialog-actions { flex-direction: column; }
}
