:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: rgba(255, 255, 255, .84);
  --surface-solid: #fff;
  --surface-subtle: #f0f0ed;
  --surface-hover: #e9e9e5;
  --text: #111;
  --muted: #777;
  --muted-2: #a0a09a;
  --border: rgba(17, 17, 17, .09);
  --border-strong: rgba(17, 17, 17, .15);
  --shadow: 0 18px 60px rgba(0, 0, 0, .07);
  --shadow-strong: 0 30px 100px rgba(0, 0, 0, .18);
  --radius: 24px;
  --accent: #111;
  --ease: cubic-bezier(.2, .75, .2, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: rgba(28, 28, 28, .86);
  --surface-solid: #181818;
  --surface-subtle: #252525;
  --surface-hover: #2c2c2c;
  --text: #f5f5f5;
  --muted: #989898;
  --muted-2: #6e6e6e;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --shadow: 0 18px 60px rgba(0, 0, 0, .24);
  --shadow-strong: 0 30px 100px rgba(0, 0, 0, .46);
  --accent: #f5f5f5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: -.01em;
}
body.store-overlay-open,
body.store-command-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; }
.is-hidden { display: none !important; }

.app-shell { width: min(1220px, calc(100% - 44px)); margin: 0 auto; }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(24px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.035em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--bg); font-size: 13px; }
.brand-name { font-size: 15px; }
.topbar-nav { display: flex; gap: 3px; margin-left: auto; margin-right: 12px; }
.topbar-nav a { padding: 8px 11px; color: var(--muted); font-size: 13px; border-radius: 10px; transition: .2s ease; }
.topbar-nav a:hover { color: var(--text); background: var(--surface-subtle); }
.icon-button {
  width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 13px; cursor: pointer; transition: transform .22s var(--ease), background .2s, border-color .2s;
}
.icon-button:hover { transform: translateY(-1px); background: var(--surface-hover); border-color: var(--border-strong); }

.hero { padding: 82px 0 56px; max-width: 820px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin-bottom: 20px; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 7%, transparent); }
.hero h1 { font-size: clamp(48px, 7vw, 88px); line-height: .95; letter-spacing: -.075em; margin: 0 0 23px; font-weight: 600; max-width: 900px; }
.hero p { margin: 0; max-width: 690px; color: var(--muted); font-size: 17px; line-height: 1.7; }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.search-box {
  height: 50px; flex: 1; max-width: 710px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); transition: border-color .2s, transform .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--border-strong); box-shadow: 0 20px 55px rgba(0,0,0,.1); transform: translateY(-1px); }
.search-box > span { color: var(--muted); font-size: 20px; line-height: 1; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--muted-2); }
kbd { color: var(--muted); font-size: 10px; border: 1px solid var(--border); background: var(--surface-subtle); padding: 5px 7px; border-radius: 7px; }
select { height: 50px; min-width: 150px; padding: 0 38px 0 14px; border: 1px solid var(--border); border-radius: 16px; color: var(--text); background: var(--surface); outline: 0; cursor: pointer; }

.category-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 5px 0 20px; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex: 0 0 auto; padding: 9px 13px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; transition: .2s ease; }
.category-tab:hover { color: var(--text); background: var(--surface-subtle); }
.category-tab.active { background: var(--text); color: var(--bg); }

.store-section { scroll-margin-top: 92px; }
.store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-bottom: 34px; }
.store-grid.is-rendering .app-card { animation: cardIn .5s var(--ease) both; animation-delay: calc(var(--card-index) * 35ms); }
.app-card {
  position: relative; min-height: 300px; overflow: hidden; display: flex; flex-direction: column; padding: 20px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .32s var(--ease), box-shadow .32s var(--ease), border-color .25s, background .25s;
}
.app-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.34), transparent 30%); transition: opacity .3s;
}
html[data-theme="dark"] .app-card::after { background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.06), transparent 30%); }
.app-card:hover { transform: translateY(-6px) scale(1.008); box-shadow: 0 28px 76px rgba(0,0,0,.11); border-color: var(--border-strong); }
.app-card:hover::after { opacity: 1; }
.app-card:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.app-card.is-hovering { box-shadow: 0 32px 90px rgba(0,0,0,.14); }
.app-card.has-preview .card-default-view { opacity: .02; transform: scale(.98); }
.card-default-view { display: flex; flex: 1; flex-direction: column; transition: opacity .38s ease, transform .38s var(--ease); }
.app-card-topline { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.app-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-subtle); font-size: 24px; font-weight: 600; }
.favorite-button { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 17px; transition: .2s ease; }
.favorite-button:hover, .favorite-button.is-active { color: var(--text); background: var(--surface-subtle); transform: scale(1.06); }
.app-title-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.app-card h2 { margin: 0; font-size: 19px; letter-spacing: -.045em; }
.app-badge { font-size: 10px; padding: 5px 8px; border-radius: 999px; background: var(--surface-subtle); color: var(--muted); white-space: nowrap; }
.app-card p { margin: 9px 0 0; color: var(--muted); line-height: 1.58; font-size: 13px; }
.app-meta { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 13px; padding-top: 22px; }
.app-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.app-tags.large { gap: 7px; }
.app-tag { font-size: 10px; padding: 5px 7px; border-radius: 7px; color: var(--muted); background: var(--surface-subtle); }
.app-tags.large .app-tag { font-size: 11px; padding: 7px 9px; border-radius: 9px; }
.app-open { font-size: 12px; font-weight: 600; white-space: nowrap; }
.hover-progress { position: absolute; left: 20px; right: 20px; bottom: 13px; height: 2px; border-radius: 2px; overflow: hidden; background: var(--surface-subtle); opacity: 0; transition: opacity .2s; }
.hover-progress span { display: block; width: 100%; height: 100%; transform-origin: left; transform: scaleX(0); background: var(--text); }
.app-card.is-hovering .hover-progress { opacity: 1; }
.app-card.is-hovering .hover-progress span { animation: hoverProgress linear forwards; }
.card-hover-preview { position: absolute; inset: 0; padding: 22px 20px 20px; display: flex; flex-direction: column; opacity: 0; transform: translateY(18px) scale(.98); transition: opacity .42s var(--ease), transform .5s var(--ease); pointer-events: none; background: linear-gradient(180deg, color-mix(in srgb, var(--surface-solid) 92%, transparent), var(--surface)); }
.app-card.has-preview .card-hover-preview { opacity: 1; transform: none; }
.preview-head { display: flex; gap: 13px; align-items: center; }
.preview-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-subtle); font-weight: 600; }
.preview-head strong { display: block; font-size: 16px; margin-bottom: 3px; }
.preview-head span { display: block; max-width: 230px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.card-hover-preview ul { display: grid; gap: 8px; margin: 23px 0 0; padding: 0; list-style: none; }
.card-hover-preview li { font-size: 12px; line-height: 1.45; padding: 10px 11px; background: var(--surface-subtle); border-radius: 11px; }
.preview-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 600; }
.preview-footer span:last-child { color: var(--text); }

.empty-state { text-align: center; padding: 95px 20px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 16px; background: var(--surface-subtle); font-size: 23px; }
.empty-state h2 { color: var(--text); font-size: 19px; margin: 0 0 8px; }
.empty-state p { margin: 0; font-size: 13px; line-height: 1.6; }
.error-state { grid-column: 1 / -1; }

.recent-rail { padding: 22px 0 64px; border-top: 1px solid var(--border); }
.section-heading { margin-bottom: 13px; }
.section-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.recent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.recent-card { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 11px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); cursor: pointer; transition: .2s ease; }
.recent-card:hover { transform: translateY(-2px); background: var(--surface-hover); border-color: var(--border-strong); }
.recent-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-subtle); font-size: 14px; font-weight: 600; }
.recent-card strong, .recent-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-card strong { font-size: 12px; }
.recent-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.recent-arrow { color: var(--muted); }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 25px 0 38px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

.modal[hidden], .command-palette[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.48); backdrop-filter: blur(10px); opacity: 0; transition: opacity .28s ease; }
.modal.is-opening .modal-backdrop, .modal.is-closing .modal-backdrop { opacity: 1; }
.modal-card {
  position: absolute; top: 0; right: 0; height: 100%; width: min(50vw, 820px); min-width: 480px;
  background: var(--surface-solid); color: var(--text); border-left: 1px solid var(--border);
  box-shadow: -35px 0 100px rgba(0,0,0,.16); transform: translateX(100%); transition: transform .46s var(--ease), width .42s var(--ease);
  display: flex; flex-direction: column; pointer-events: auto;
}
.modal.is-opening .modal-card { transform: translateX(0); }
.modal.is-closing .modal-card { transform: translateX(100%); }
.modal.is-fullscreen .modal-card { width: 100%; min-width: 0; border-left: 0; box-shadow: none; }
.modal.is-fullscreen .modal-backdrop { display: none; }
.modal-topbar { flex: 0 0 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-solid) 93%, transparent); backdrop-filter: blur(18px); }
.modal-topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-context { font-size: 10px; color: var(--muted); letter-spacing: .11em; font-weight: 700; }
.modal-separator { color: var(--muted-2); }
.modal-topbar-left strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-topbar-actions { display: flex; gap: 6px; }
.modal-control { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; transition: .2s ease; }
.modal-control:hover { background: var(--surface-subtle); color: var(--text); }
.close-control { font-size: 22px; }
.modal-content { flex: 1; overflow: auto; padding: clamp(28px, 4vw, 54px); scrollbar-width: thin; }
.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-thumb { background: var(--surface-hover); border-radius: 10px; }
.detail-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 18px; padding-bottom: 42px; }
.detail-app-icon { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 24px; background: var(--surface-subtle); font-size: 32px; font-weight: 600; animation: detailPop .58s var(--ease) both; }
.detail-hero-copy { padding-top: 3px; animation: detailTextIn .58s var(--ease) .04s both; }
.detail-kicker { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 9px; }
.detail-hero-copy h2 { margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1; letter-spacing: -.065em; }
.detail-hero-copy p { margin: 13px 0 0; color: var(--muted); max-width: 570px; line-height: 1.65; font-size: 14px; }
.detail-favorite { margin-top: 1px; }
.detail-section { padding: 26px 0; border-top: 1px solid var(--border); animation: sectionIn .52s var(--ease) both; }
.detail-section:nth-of-type(2) { animation-delay: .04s; }
.detail-section:nth-of-type(3) { animation-delay: .08s; }
.detail-section:nth-of-type(4) { animation-delay: .12s; }
.detail-copy p { margin: 11px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; max-width: 720px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.feature-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-subtle); }
.feature-item span { color: var(--muted-2); font-size: 10px; padding-top: 1px; }
.feature-item p { margin: 0; font-size: 12px; line-height: 1.55; }
.screenshot-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 46%); gap: 10px; overflow-x: auto; padding-top: 13px; scrollbar-width: thin; }
.screenshot-frame { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-subtle); }
.screenshot-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.detail-facts > div { display: flex; flex-direction: column; gap: 5px; padding: 13px; border-radius: 13px; background: var(--surface-subtle); }
.detail-facts span { font-size: 10px; color: var(--muted); }
.detail-facts strong { font-size: 12px; }
.detail-actions { display: flex; gap: 9px; padding: 28px 0 10px; }
.primary-button, .secondary-button { min-height: 47px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border-radius: 13px; border: 1px solid var(--border); cursor: pointer; font-weight: 600; font-size: 12px; transition: transform .2s var(--ease), background .2s, border-color .2s; }
.primary-button { background: var(--text); color: var(--bg); border-color: var(--text); }
.secondary-button { background: var(--surface); color: var(--text); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.primary-button span { font-size: 14px; }
.modal-loading, .modal-error { min-height: 55vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.modal-loading p, .modal-error p { color: var(--muted); font-size: 12px; }
.loader { width: 31px; height: 31px; border: 3px solid var(--surface-subtle); border-top-color: var(--text); border-radius: 50%; animation: spin .75s linear infinite; }
.modal-error-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-subtle); font-weight: 700; }
.modal-error h2 { margin: 14px 0 0; font-size: 20px; }

.command-palette { position: fixed; inset: 0; z-index: 140; display: grid; place-items: start center; padding-top: min(14vh, 120px); }
.command-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.42); backdrop-filter: blur(10px); opacity: 0; transition: opacity .2s ease; }
.command-card { position: relative; width: min(680px, calc(100% - 30px)); background: var(--surface-solid); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-strong); overflow: hidden; transform: translateY(-16px) scale(.98); opacity: 0; transition: transform .28s var(--ease), opacity .2s ease; }
.command-palette.is-opening .command-backdrop { opacity: 1; }
.command-palette.is-opening .command-card { transform: none; opacity: 1; }
.command-palette.is-closing .command-backdrop { opacity: 0; }
.command-palette.is-closing .command-card { transform: translateY(-10px) scale(.99); opacity: 0; }
.command-search { height: 62px; display: flex; align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.command-search > span { color: var(--muted); font-size: 21px; }
.command-search input { min-width: 0; flex: 1; background: transparent; color: var(--text); border: 0; outline: 0; font-size: 15px; }
.command-search button { color: var(--muted); background: var(--surface-subtle); border-radius: 8px; padding: 4px 7px; cursor: pointer; }
.command-results { max-height: 390px; overflow: auto; padding: 7px; }
.command-result { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; text-align: left; padding: 10px; color: var(--text); background: transparent; border-radius: 13px; cursor: pointer; }
.command-result:hover { background: var(--surface-subtle); }
.command-result-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-subtle); font-weight: 600; }
.command-result-copy { min-width: 0; }
.command-result-copy strong, .command-result-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-result-copy strong { font-size: 12px; }
.command-result-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.command-result > kbd { min-width: 28px; text-align: center; }
.command-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.command-footer { display: flex; justify-content: space-between; gap: 12px; padding: 11px 15px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes hoverProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes detailPop { from { opacity: 0; transform: scale(.84) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes detailTextIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes sectionIn { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: none; } }

@media (max-width: 1000px) {
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-card { width: min(620px, 100%); }
  .recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .app-shell { width: min(100% - 24px, 1220px); }
  .topbar-nav { display: none; }
  .hero { padding: 57px 0 42px; }
  .hero h1 { font-size: 50px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
  .toolbar-actions select { width: 100%; }
  .store-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 275px; }
  .recent-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }

  .modal-card { width: 100%; min-width: 0; }
  .modal.is-side .modal-backdrop { background: rgba(0,0,0,.48); }
  .modal-content { padding: 24px 20px 36px; }
  .detail-hero { grid-template-columns: auto minmax(0, 1fr); }
  .detail-favorite { grid-column: 2; justify-self: start; margin-top: -10px; }
  .feature-grid, .detail-facts { grid-template-columns: 1fr; }
  .detail-actions { flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .screenshot-strip { grid-auto-columns: 76%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
