:root {
  color-scheme: dark;
  --bg: #040b14;
  --surface: #091829;
  --surface-raised: #0d2034;
  --border: rgba(101, 220, 255, 0.17);
  --cyan: #20d8ff;
  --cyan-light: #8beeff;
  --white: #f7fbff;
  --muted: #a8b8c8;
  --radius: 20px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  --glow: 0 0 28px rgba(32, 216, 255, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 18px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(21, 109, 151, 0.2), transparent 30rem),
    linear-gradient(180deg, #071526 0%, var(--bg) 35%, #030912 100%);
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-shell {
  width: min(100% - 32px, 1020px);
  margin-inline: auto;
  padding: 48px 0 64px;
}

.page-header {
  margin-bottom: 30px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.page-header h1::after {
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(32, 216, 255, 0.55);
  content: "";
}

.page-header p {
  max-width: 610px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 3.6vw, 1.15rem);
}

.search-section {
  width: 100%;
  max-width: 620px;
  margin: 24px 0 22px;
}

.search-label {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--cyan-light);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  color: var(--cyan);
  font-size: 1.35rem;
  line-height: 1;
  transform: translateY(-53%);
  pointer-events: none;
}

#category-search {
  width: 100%;
  height: 46px;
  padding: 0 15px 0 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: rgba(9, 24, 41, 0.92);
  color: var(--white);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

#category-search::placeholder {
  color: #718397;
  font-size: 0.82rem;
}

#category-search:focus {
  border-color: rgba(32, 216, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(32, 216, 255, 0.1), var(--glow);
}

.search-status {
  min-height: 20px;
  margin: 7px 2px 0;
  color: #ffb4b4;
  font-size: 0.84rem;
}

.catalog-section + .catalog-section {
  margin-top: 46px;
}

.catalog-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--cyan-light);
  font-size: 0.88rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.catalog-section h2::after {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--border), transparent);
  content: "";
}

.accordion-group {
  display: grid;
  gap: 16px;
}

.category-card {
  overflow: hidden;
  scroll-margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.category-card:hover,
.category-card:focus-within,
.category-card.is-open {
  border-color: rgba(32, 216, 255, 0.42);
  box-shadow: var(--shadow), var(--glow);
}

.category-card.search-hit {
  animation: search-pulse 900ms ease;
}

.category-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.cover-wrap {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(32, 216, 255, 0.16), transparent 55%),
    #0a2136;
}

.cover-wrap::after {
  position: absolute;
  inset: auto 0 0;
  height: 35%;
  background: linear-gradient(transparent, rgba(4, 11, 20, 0.7));
  content: "";
  pointer-events: none;
}

.cover-wrap img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 350ms ease;
}

.cover-wrap img.is-missing {
  display: none;
}

.cover-fallback {
  position: absolute;
  padding: 20px;
  color: rgba(139, 238, 255, 0.5);
  font-size: clamp(1.15rem, 5vw, 2rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  text-align: center;
  text-transform: uppercase;
}

.category-toggle:hover .cover-wrap img {
  transform: scale(1.025);
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 11px 15px;
}

.category-name {
  font-size: clamp(1.05rem, 4.5vw, 1.25rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.toggle-icon {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(32, 216, 255, 0.07);
}

.toggle-icon::before,
.toggle-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--cyan);
  content: "";
  transform: translate(-50%, -50%);
  transition: transform 220ms ease;
}

.toggle-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.category-toggle[aria-expanded="true"] .toggle-icon::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.category-panel {
  display: grid;
  grid-template-rows: 0fr;
  border-top: 0 solid var(--border);
  visibility: hidden;
  transition: grid-template-rows 260ms ease, visibility 260ms, border-width 260ms ease;
}

.category-card.is-open .category-panel {
  grid-template-rows: 1fr;
  border-top-width: 1px;
  visibility: visible;
}

.catalog-list {
  display: grid;
  gap: 11px;
  min-height: 0;
  overflow: hidden;
  padding: 0 14px;
  transition: padding 260ms ease;
}

.category-card.is-open .catalog-list {
  padding-block: 12px;
}

.catalog-item {
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 15px;
  background: var(--surface-raised);
}

.catalog-name {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #eaf7ff;
  font-weight: 700;
}

.catalog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
.category-toggle:focus-visible {
  outline: 3px solid rgba(32, 216, 255, 0.38);
  outline-offset: -3px;
}

.btn-primary {
  background: var(--cyan);
  color: #02121b;
  box-shadow: 0 6px 18px rgba(32, 216, 255, 0.2);
}

.btn-primary:hover {
  background: #72eaff;
  box-shadow: 0 8px 24px rgba(32, 216, 255, 0.3);
}

.btn-secondary {
  border-color: rgba(139, 238, 255, 0.25);
  background: transparent;
  color: var(--cyan-light);
}

.btn-secondary:hover {
  background: rgba(32, 216, 255, 0.08);
}

@keyframes search-pulse {
  0%, 100% { box-shadow: var(--shadow), var(--glow); }
  45% { box-shadow: var(--shadow), 0 0 0 4px rgba(32, 216, 255, 0.24), 0 0 38px rgba(32, 216, 255, 0.32); }
}

@media (min-width: 769px) {
  .site-shell {
    padding-top: 72px;
  }

  .accordion-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .category-card.is-open {
    grid-column: 1 / -1;
  }

  .category-card.is-open .category-toggle {
    display: grid;
    grid-template-columns: minmax(280px, 42%) 1fr;
    align-items: stretch;
  }

  .category-card.is-open .cover-wrap {
    max-height: 220px;
  }

  .category-card.is-open .category-heading {
    align-self: center;
    padding: 18px 20px;
  }

  .catalog-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .catalog-actions {
    grid-template-columns: repeat(2, 130px);
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .cover-wrap {
    max-height: 190px;
  }

  .category-card.is-open .cover-wrap {
    max-height: 190px;
  }
}

@media (max-width: 768px) {
  .search-section {
    max-width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  #category-search {
    height: 44px;
    font-size: 0.8125rem;
  }

  #category-search::placeholder {
    font-size: 0.78rem;
  }

  .cover-wrap {
    max-height: 160px;
  }

  .category-card.is-open .category-toggle {
    display: block;
  }

  .category-heading {
    min-height: 54px;
    padding: 10px 14px;
  }

  .accordion-group {
    gap: 13px;
  }

  .catalog-list {
    padding-inline: 11px;
  }

  .category-card.is-open .catalog-list {
    padding-block: 11px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
