:root {
  --tg-blue: #3390ec;
  --tg-blue-dark: #2b7fd1;
  --tg-bg: #eff3f6;
  --tg-panel: #ffffff;
  --tg-text: #1f2a36;
  --tg-muted: #6d7b88;
  --tg-line: rgba(18, 34, 52, 0.08);
  --tg-shadow: 0 12px 30px rgba(15, 31, 47, 0.08);
  --mia-petal: #ffd8e6;
  --mia-mint: #dff6ea;
  --mia-cream: #fff9ec;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --page-width: 1180px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #f6f9fb 0%, var(--tg-bg) 100%);
  color: var(--tg-text);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
}

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

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
}

.hero {
  padding: 40px 20px 18px;
}

.hero__inner,
.content {
  max-width: var(--page-width);
  margin: 0 auto;
}

.hero__inner {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 216, 230, 0.72), transparent 30%),
    radial-gradient(circle at 84% 20%, rgba(223, 246, 234, 0.86), transparent 28%),
    radial-gradient(circle at 76% 88%, rgba(51, 144, 236, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 32px;
  box-shadow: 0 18px 42px rgba(15, 31, 47, 0.1);
  backdrop-filter: blur(14px);
  padding: 28px;
}

.hero__inner::before,
.hero__inner::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.hero__inner::before {
  width: 240px;
  height: 240px;
  top: -96px;
  right: 10%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), rgba(255, 216, 230, 0.08) 68%, transparent 72%);
}

.hero__inner::after {
  width: 184px;
  height: 184px;
  bottom: -92px;
  left: 6%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.54), rgba(223, 246, 234, 0.14) 64%, transparent 72%);
}

.hero__badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--tg-blue-dark);
  border: 1px solid rgba(51, 144, 236, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(51, 144, 236, 0.08);
}

.hero__title {
  position: relative;
  z-index: 1;
  margin: 16px 0 8px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.hero__summary {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 0;
  max-width: none;
  color: var(--tg-muted);
  font-size: 16px;
  line-height: 1.6;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  flex-wrap: wrap;
}

.search {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  background: rgba(15, 31, 47, 0.04);
  border: 1px solid rgba(15, 31, 47, 0.06);
  border-radius: 999px;
  padding: 0 16px;
}

.search__icon {
  color: var(--tg-muted);
  font-size: 18px;
}

.search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--tg-text);
}

.toolbar__count {
  color: var(--tg-muted);
  font-size: 14px;
  font-weight: 600;
}

.content {
  padding: 4px 20px 40px;
}

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

.pack-card {
  background: var(--tg-panel);
  border: 1px solid var(--tg-line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(18, 34, 52, 0.05);
  padding: 16px;
  display: grid;
  gap: 14px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.pack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(18, 34, 52, 0.09);
  border-color: rgba(51, 144, 236, 0.2);
}

.pack-card__header {
  display: flex;
  gap: 14px;
  align-items: center;
}

.pack-card__cover {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  object-fit: cover;
  background: #f6f7f9;
  flex: 0 0 auto;
}

.pack-card__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.pack-card__author {
  margin: 6px 0 0;
  color: var(--tg-muted);
  font-size: 14px;
}

.pack-card__meta {
  margin-top: 10px;
  color: var(--tg-muted);
  font-size: 13px;
}

.pack-card__preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pack-card__sticker {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7f9fb, #eef2f5);
  object-fit: contain;
  padding: 6px;
}

.pack-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(51, 144, 236, 0.1);
  color: var(--tg-blue-dark);
  font-weight: 700;
  font-size: 14px;
}

.pack-card__action.is-disabled,
.button.is-disabled {
  background: rgba(15, 31, 47, 0.06);
  color: var(--tg-muted);
  border-color: rgba(15, 31, 47, 0.06);
}

.button.is-disabled {
  cursor: default;
  pointer-events: none;
}

.button.is-hidden {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 18px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px dashed rgba(15, 31, 47, 0.12);
  color: var(--tg-muted);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 47, 0.45);
  backdrop-filter: blur(10px);
}

.modal__sheet {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  margin: 10px auto;
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 30px;
  box-shadow: 0 24px 44px rgba(15, 31, 47, 0.2);
  padding: 22px;
}

.modal__close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 31, 47, 0.06);
  color: var(--tg-text);
  cursor: pointer;
  font-size: 28px;
}

.modal__header {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 4px;
}

.modal__cover {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  object-fit: cover;
  background: #f6f7f9;
}

.modal__kicker {
  color: var(--tg-blue-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal__title {
  margin: 8px 0 8px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.05;
}

.modal__author,
.modal__stats {
  margin: 0;
  color: var(--tg-muted);
}

.modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}

.button--primary {
  background: var(--tg-blue);
  color: #fff;
}

.button--primary:hover {
  background: var(--tg-blue-dark);
}

.button--secondary {
  background: rgba(51, 144, 236, 0.12);
  color: var(--tg-blue-dark);
}

.button--ghost {
  background: rgba(15, 31, 47, 0.04);
  color: var(--tg-text);
  border-color: rgba(15, 31, 47, 0.06);
}

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

.preview-grid__item {
  aspect-ratio: 1;
  width: 100%;
  object-fit: contain;
  padding: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f9fb, #edf1f5);
}

@media (max-width: 720px) {
  .hero {
    padding: 16px 12px 8px;
  }

  .hero__inner,
  .content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero__inner {
    padding: 20px;
    border-radius: 26px;
  }

  .content {
    padding-bottom: 24px;
  }

  .pack-grid {
    grid-template-columns: 1fr;
  }

  .modal__sheet {
    width: 100vw;
    max-height: calc(100vh - 4px);
    margin: 4px auto 0;
    border-radius: 28px 28px 0 0;
    padding: 16px;
  }

  .modal__header {
    align-items: flex-start;
  }

  .modal__cover {
    width: 88px;
    height: 88px;
    border-radius: 22px;
  }
}
