:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #087f5b;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f7f9fc;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #fff; font-family: Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

header { height: 68px; padding: 0 clamp(20px, 5vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
header nav, .site-footer div { display: flex; gap: 22px; font-size: 13px; }
.logo { font-size: 25px; font-weight: 800; letter-spacing: -1.5px; }
.logo span, .catalog-head small, .product small { color: var(--blue); }

.catalog { width: min(1180px, calc(100% - 40px)); min-height: 75vh; margin: 0 auto; padding: 56px 0 72px; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.catalog-head h1 { margin: 9px 0; font-size: clamp(34px, 4vw, 46px); line-height: 1.05; letter-spacing: -1.5px; }
.catalog-head p { margin-bottom: 0; color: var(--muted); }
.catalog-head input { width: min(300px, 100%); min-height: 44px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.catalog-head input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #2563eb20; }

.filters { display: flex; gap: 8px; margin: 30px 0 22px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.filters .active { color: #fff; background: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; gap: 20px; }
.product { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 4px 16px #1018280a; }
.product > img { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: contain; background: var(--soft); }
.product > div { padding: 16px; }
.product h2 { margin: 7px 0 9px; font-size: 18px; line-height: 1.25; letter-spacing: -.25px; }
.product p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.product footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.product footer b { white-space: nowrap; }
.product-actions { display: flex; align-items: center; gap: 8px; }
.details-button { min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-weight: 700; }
.details-button:hover { border-color: #98a2b3; background: var(--soft); }
.buy { min-height: 42px; padding: 10px 15px; border: 0; border-radius: 9px; color: #fff; background: var(--blue); font-weight: 700; }
.buy:hover { background: var(--blue-dark); }
.buy.download { background: var(--green); }
.buy:disabled { opacity: .65; cursor: wait; }
.empty { padding: 80px 20px; color: var(--muted); text-align: center; }

.site-footer { padding: 28px clamp(20px, 5vw, 64px); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }

dialog { width: min(480px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow-y: auto; padding: 34px; border: 0; border-radius: 16px; box-shadow: 0 25px 70px #0005; }
dialog::backdrop { background: #101828b5; }
.close { float: right; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f2f4f7; font-size: 20px; }
.details-close { position: absolute; top: 14px; right: 14px; z-index: 1; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 12px #10182826; font-size: 20px; }
.details-dialog { width: min(620px, calc(100vw - 28px)); padding: 0 0 26px; }
.details-dialog > img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 16px 16px 0 0; background: var(--soft); }
.details-dialog > small, .details-dialog > h2, .details-dialog > p, .details-dialog > footer { display: block; margin-right: 26px; margin-left: 26px; }
.details-dialog > small { margin-top: 22px; color: var(--blue); }
.details-dialog > h2 { margin-top: 7px; margin-bottom: 12px; font-size: 25px; line-height: 1.2; }
.details-dialog .full-description { max-height: 34vh; overflow-y: auto; white-space: pre-line; font-size: 15px; line-height: 1.6; }
.details-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 8px; }
.details-actions { display: flex; align-items: center; gap: 8px; }
.share-button { min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-weight: 700; }
.share-button:hover { border-color: #98a2b3; background: var(--soft); }
dialog p, #paymentMessage { color: var(--muted); line-height: 1.5; }
#paymentMessage { margin-top: 15px; }
#paymentMessage a { color: var(--blue); font-weight: 700; }

.cookie-banner { position: fixed; z-index: 20; right: 18px; bottom: 18px; left: 18px; width: min(900px, calc(100% - 36px)); margin: auto; padding: 17px 19px; border: 1px solid var(--line); border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: #fff; box-shadow: 0 18px 55px #1018282e; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 5px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.cookie-banner a { color: var(--blue); font-size: 13px; }
.cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-actions button { min-height: 42px; padding: 9px 13px; border-radius: 8px; font-weight: 700; }
.cookie-secondary { border: 1px solid var(--line); background: #fff; }
.cookie-primary { border: 1px solid var(--blue); color: #fff; background: var(--blue); }

@media (min-width: 1180px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  header { height: 60px; padding: 0 18px; }
  header nav { display: none; }
  .catalog { width: min(100% - 28px, 560px); padding: 32px 0 50px; }
  .catalog-head { display: block; }
  .catalog-head h1 { margin-top: 7px; font-size: 32px; letter-spacing: -1px; }
  .catalog-head p { margin-top: 10px; font-size: 14px; line-height: 1.45; }
  .catalog-head input { width: 100%; margin-top: 20px; font-size: 16px; }
  .filters { margin: 22px -14px 18px; padding: 0 14px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .product { border-radius: 13px; }
  .product > div { padding: 15px; }
  .product h2 { font-size: 18px; }
  .product p { -webkit-line-clamp: 3; }
  .product footer { margin-top: 14px; }
  .product-actions { gap: 7px; }
  .details-button { min-height: 44px; }
  .buy { min-width: 112px; min-height: 44px; }
  .site-footer { padding: 26px 18px; display: grid; justify-items: start; }
  .site-footer div { gap: 12px 18px; flex-wrap: wrap; }
  dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 22px 18px; border-radius: 14px; }
  dialog h2 { margin-top: 9px; padding-right: 42px; font-size: 22px; line-height: 1.2; }
  dialog p { font-size: 14px; }
  .details-dialog { width: calc(100vw - 20px); padding-bottom: 20px; }
  .details-dialog > small, .details-dialog > h2, .details-dialog > p, .details-dialog > footer { margin-right: 18px; margin-left: 18px; }
  .details-dialog > small { margin-top: 18px; }
  .details-dialog > h2 { padding-right: 0; }
  .details-dialog .full-description { max-height: 30vh; }
  .details-dialog > footer { align-items: stretch; flex-direction: column; }
  .details-actions { width: 100%; }
  .details-actions button { flex: 1; }
  .cookie-banner { right: 10px; bottom: 10px; left: 10px; width: calc(100% - 20px); padding: 15px; align-items: stretch; flex-direction: column; gap: 14px; }
  .cookie-actions button { flex: 1; }
}

@media (max-width: 380px) {
  .catalog { width: calc(100% - 20px); }
  .catalog-head h1 { font-size: 29px; }
  .product footer { align-items: stretch; flex-direction: column; }
  .product-actions { width: 100%; }
  .product-actions button { flex: 1; }
  .buy { width: 100%; }
  .cookie-actions { flex-direction: column; }
}
