:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #68727d;
  --line: #dfe2e3;
  --brand: #2563eb;
  --brand-dark: #173b8f;
  --green: #0f8a6a;
  --amber: #b66a08;
  --coral: #d34d3f;
  --mint: #d9f3eb;
  --sky: #dceafe;
  --lavender: #ece7ff;
  --shadow: 0 18px 55px rgba(36, 45, 54, 0.13);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background: #f7f9fd;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #f7f9fd;
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 92% 6%, rgba(37, 99, 235, 0.14), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #f4f8ff 48%, #fff6ec 100%);
}

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

button,
input {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  padding: 24px clamp(18px, 4vw, 56px) 38px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  grid-template-rows: repeat(3, 5px);
  place-content: center;
  gap: 3px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.18);
}

.brand-mark span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: #ffffff;
}

.brand-mark span:nth-child(2) {
  background: #dceafe;
}

.brand-mark span:nth-child(4),
.brand-mark span:nth-child(6) {
  background: #d9f3eb;
}

.brand-mark span:nth-child(5) {
  background: #ffffff;
}

.brand-mark span:nth-child(7),
.brand-mark span:nth-child(9) {
  background: #ffe5db;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 740px;
  margin-bottom: 20px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.search-band {
  display: flex;
  justify-content: center;
  padding: clamp(42px, 8vw, 92px) 0 clamp(28px, 5vw, 54px);
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(760px, 100%);
  min-height: 62px;
  padding: 0 18px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.12);
}

.search-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #667381;
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: #667381;
  transform: rotate(45deg);
}

.hero-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.catalog {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  padding: 18px clamp(18px, 4vw, 56px) 64px;
}

.filters {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(23, 32, 38, 0.06);
  scrollbar-gutter: stable;
}

.filters::-webkit-scrollbar {
  width: 8px;
}

.filters::-webkit-scrollbar-track {
  background: transparent;
}

.filters::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(104, 114, 125, 0.28);
  background-clip: padding-box;
}

.filters::-webkit-scrollbar-thumb:hover {
  background: rgba(104, 114, 125, 0.46);
  background-clip: padding-box;
}

.filter-block + .filter-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.filter-title {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-list {
  display: grid;
  gap: 8px;
}

.filter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #33404a;
  cursor: pointer;
  text-align: left;
}

.filter-button:hover,
.filter-button.active {
  border-color: rgba(37, 99, 235, 0.2);
  background: #eef5ff;
  color: var(--brand-dark);
}

.filter-button span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.results {
  min-width: 0;
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.results-head h2 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: 0;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.featured-wrap {
  margin-bottom: 28px;
}

.featured-wrap h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.featured-grid,
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 18px;
  overflow: visible;
}

.featured-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.app-card {
  position: relative;
  display: block;
  min-height: 0;
  aspect-ratio: 16 / 10;
  overflow: visible;
  z-index: 1;
}

.app-card-link {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 38, 0.1);
  border-radius: 12px;
  background: #eef2f6;
  box-shadow: 0 16px 34px rgba(23, 32, 38, 0.11);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.app-card:hover,
.app-card:focus-within {
  z-index: 8;
}

.app-card:hover .app-card-link,
.app-card:focus-within .app-card-link {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 24px 48px rgba(23, 32, 38, 0.15);
}

.app-card-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.38);
  outline-offset: 3px;
}

.app-card.disabled .app-card-link {
  cursor: default;
  filter: grayscale(0.12);
}

.app-card-info {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 34px rgba(23, 32, 38, 0.16);
  backdrop-filter: blur(14px);
}

.app-card-top {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  margin-bottom: 14px;
}

.app-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #edf3ff;
  color: var(--brand);
  font-size: 14px;
  font-weight: 900;
}

.app-card h3 {
  margin: 0;
  display: -webkit-box;
  overflow-wrap: anywhere;
  overflow: hidden;
  color: #101820;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-dept {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  margin-bottom: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.06)),
    var(--preview-bg, #edf3ff);
}

.app-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(23, 32, 38, 0) 42%, rgba(23, 32, 38, 0.42) 100%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(255, 255, 255, 0.26) 100%),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.app-preview.placeholder span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--preview-fg, var(--brand));
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 38, 0.08);
}

.app-shot-bg {
  position: absolute;
  inset: -18px;
  z-index: 0;
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  object-fit: cover;
  object-position: top left;
  filter: blur(14px) saturate(1.08);
  opacity: 0.72;
  transform: scale(1.04);
}

.app-shot {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  filter: saturate(1.02) contrast(1.01);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  mask-image: radial-gradient(ellipse at center, #000 66%, rgba(0, 0, 0, 0.88) 78%, rgba(0, 0, 0, 0.18) 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 66%, rgba(0, 0, 0, 0.88) 78%, rgba(0, 0, 0, 0.18) 100%);
  transition:
    transform 260ms ease;
}

.app-card:hover .app-shot {
  transform: scale(1.025);
}

.app-detail {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  z-index: 12;
  width: min(320px, 78vw);
  min-height: 238px;
  padding: 18px;
  border: 1px solid rgba(23, 32, 38, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 58px rgba(23, 32, 38, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-8px) scale(0.98);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  backdrop-filter: blur(18px);
}

.app-detail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -18px;
  width: 18px;
}

.app-card:nth-child(3n) .app-detail {
  right: calc(100% + 14px);
  left: auto;
  transform: translateY(-50%) translateX(8px) scale(0.98);
}

.app-card:nth-child(3n) .app-detail::before {
  right: -18px;
  left: auto;
}

.app-card:hover .app-detail,
.app-card:focus-within .app-detail,
.app-card.detail-open .app-detail {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0) scale(1);
}

.app-card:nth-child(3n):hover .app-detail,
.app-card:nth-child(3n):focus-within .app-detail,
.app-card:nth-child(3n).detail-open .app-detail {
  transform: translateY(-50%) translateX(0) scale(1);
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-bottom: 14px;
}

.detail-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
}

.detail-title {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.28;
}

.detail-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-desc {
  min-height: 52px;
  margin-bottom: 14px;
  color: #4f5d68;
  line-height: 1.65;
}

.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: #edf8f4;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #33404a;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.action-link.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed #bdc5ce;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.site-footer {
  width: calc(100% - clamp(36px, 8vw, 112px));
  margin: 6px auto 48px;
  padding-top: 18px;
  border-top: 1px solid rgba(104, 114, 125, 0.26);
  text-align: center;
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  color: #4f5d68;
  font-size: 14px;
  font-weight: 800;
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.admin-entry:hover,
.admin-entry:focus-visible {
  background: rgba(255, 255, 255, 0.76);
  color: var(--brand-dark);
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.08);
  outline: 0;
}

@media (max-width: 1120px) {
  .catalog {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .filter-list,
  .filter-list.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .featured-grid,
  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-card {
    aspect-ratio: 16 / 9.5;
  }

  .app-card {
    aspect-ratio: auto;
  }

  .app-card-link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9.5;
  }

  .app-detail,
  .app-card:nth-child(3n) .app-detail {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    min-height: 0;
    margin-top: 10px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .app-card:hover .app-detail,
  .app-card:focus-within .app-detail,
  .app-card.detail-open .app-detail,
  .app-card:nth-child(3n):hover .app-detail,
  .app-card:nth-child(3n):focus-within .app-detail,
  .app-card:nth-child(3n).detail-open .app-detail {
    transform: none;
  }
}

@media (max-width: 720px) {
  .hero {
    min-height: auto;
    padding: 14px 14px 22px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    font-size: 15px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 11px;
  }

  h1 {
    font-size: 42px;
  }

  .hero-stage {
    gap: 24px;
    padding: 36px 0 10px;
  }

  .hero-text {
    margin-bottom: 22px;
    font-size: 15px;
    line-height: 1.7;
  }

  .hero-search {
    min-height: 50px;
    padding: 0 14px;
  }

  .catalog {
    gap: 20px;
    padding: 22px 14px 42px;
  }

  .filters {
    padding: 14px;
  }

  .filter-button {
    min-height: 36px;
  }

  .results-head h2 {
    font-size: 26px;
  }

  .filter-list,
  .filter-list.compact,
  .featured-grid,
  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    aspect-ratio: auto;
  }

  .app-card-link {
    aspect-ratio: 16 / 10;
  }

  .app-card-info {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

}
