:root {
  --blue: #0091ea;
  --blue2: #e6f4ff;
  --blue3: #c7e8ff;
  --blue4: #0077c2;
  --text: #10324f;
  --muted: #6b87a3;
  --card: #ffffff;
  --bg: #f5fbff;
  --line: #d7eaf8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color: var(--text);
}

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

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .2px;
}

.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), #4fc3ff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--shadow);
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .04);
}

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

.pillbtn,
.ghostbtn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s transform, .2s background, .2s color;
}

.pillbtn {
  background: var(--blue);
  color: #fff;
}

.pillbtn:hover,
.ghostbtn:hover {
  transform: translateY(-1px);
}

.ghostbtn {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--line);
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 18px;
  padding-top: 18px;
}

.sidebar,
.panel {
  background: rgba(255, 255, 255, .85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 16px;
  position: sticky;
  top: 92px;
  height: fit-content;
}

.side-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 6px 0 12px;
}

.navitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text);
  margin-bottom: 8px;
  background: linear-gradient(180deg, #fff, #f9fdff);
  border: 1px solid transparent;
}

.navitem.active {
  background: linear-gradient(135deg, var(--blue2), #fff);
  border-color: #b9dbf3;
  color: #004b7a;
  font-weight: 700;
}

.badge {
  background: var(--blue3);
  color: #004b7a;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.hero {
  padding: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #eff8ff 45%, #dff2ff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 38px;
  line-height: 1.05;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hero-art {
  position: absolute;
  right: -8px;
  top: -6px;
  opacity: .22;
  font-size: 160px;
  transform: rotate(8deg);
  user-select: none;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 700;
  color: #335773;
}

.chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 20px 4px 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: .2s transform, .2s box-shadow;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, .12);
}

.thumb {
  aspect-ratio: 1/1;
  background: linear-gradient(135deg, #bfe4ff, #f5fbff 55%, #81c9ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  position: relative;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: auto 16px 16px auto;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(16, 50, 79, .08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #174c74;
  content: attr(data-tag);
}

.card-body {
  padding: 14px;
}

.title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.stat {
  background: #f4fbff;
  border: 1px solid #d6ebf8;
  color: #2f5f84;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.sort {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 28, .52);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-card {
  max-width: 900px;
  width: 100%;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .3);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}

.modal-img {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #d2ecff, #fff 48%, #91d2ff);
  display: grid;
  place-items: center;
  font-size: 180px;
  overflow: hidden;
}

.modal-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-body {
  padding: 24px;
  position: relative;
}

.close {
  position: absolute;
  right: 18px;
  top: 18px;
  border: 0;
  background: #fff;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

footer {
  padding: 26px 18px 40px;
  color: var(--muted);
  text-align: center;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 20px;
}

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

  .sidebar {
    position: static;
  }

  .modal-card {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-art {
    font-size: 120px;
  }
}

@media (max-width:640px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .search {
    order: 3;
    flex-basis: 100%;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .hero-art {
    display: none;
  }

  .toggle-arrow {
    float: right;
    transition: transform .2s;
  }

  @media (max-width: 980px) {
    .sidebar-toggle {
      cursor: pointer;
      user-select: none;
    }

    .sidebar-content {
      display: none;
      overflow: hidden;
    }

    .sidebar-section.open .sidebar-content {
      display: block;
    }

    .sidebar-section.open .toggle-arrow {
      transform: rotate(180deg);
    }
  }
}