:root{
  --control-h:50px;
  --module-card-height:580px;
  --module-thumb-height:200px;
  --row-lh:1.25;
  --row-h:1.4rem;
  --row-h-meta:1.8rem;
  --chip-h:28px;
  --chip-px:.55rem;
}

body.dark-theme{
  background:#000;
  color:#fff;
  font-family:'Roboto',sans-serif;
}

.card-dark{
  background:#1f1f1f;
  border-radius:16px;
  padding:2rem;
  margin-bottom:2rem;
}

.text-orange{color:#ffa726;}

.btn-back{
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  color:#fff;
  font-weight:bold;
  border-radius:1rem;
  padding:.5rem 1.5rem;
  text-decoration:none;
  border:0;
  display:inline-block;
}
.btn-back:hover{
  background:linear-gradient(135deg,#ff6500,#d94e00);
  color:#fff;
  text-decoration:none;
}

.btn-disabled{
  opacity:.6;
  cursor:not-allowed;
  border:1px solid #444;
  border-radius:999px;
  padding:.55rem 1.05rem;
  color:#aaa!important;
  display:inline-block;
  text-decoration:none!important;
  box-shadow:0 6px 18px rgba(0,0,0,.18);
  background:transparent;
}

button.btn-back,
a.btn-back,
button.btn-disabled,
a.btn-disabled{
  display:inline-block;
  text-decoration:none!important;
}

.file-list{list-style:none;padding-left:0;margin:0;}
.file-list li{
  display:flex;
  justify-content:space-between;
  padding:8px 0;
  border-bottom:1px solid rgba(255,255,255,.1);
}
.file-list a{color:#ffa726;text-decoration:none;}
.file-list a:hover{text-decoration:underline;}

.module-desc{
  color:#ccc;
  font-weight:500;
  white-space:normal;
  overflow-wrap:anywhere;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
  line-height:1.55;
  font-size:.98rem;
}
.module-desc-box{
  background:#2a2a2a;
  border-left:4px solid #ff7b00;
  border-radius:12px;
  padding:.8rem 1rem;
  font-family:monospace;
  color:#ddd;
  white-space:pre-line;
  line-height:1.55;
  font-size:.95rem;
  overflow:hidden;
  position:relative;
  min-height:calc(1.55em * 1);
}

.module-meta{
  color:#aaa;
  font-size:.85rem;
  margin:.25rem 0 .75rem;
  display:flex;
  align-items:center;
  gap:.5rem;
  flex-wrap:wrap;
}

.module-card{
  position:relative;
  border-radius:16px;
  padding:1.25rem 1.25rem 1rem;
  transition:transform .2s ease,box-shadow .2s ease;
  display:flex;
  flex-direction:column;
  height:100%;
}
.module-card:hover{transform:translateY(-2px);box-shadow:0 12px 32px rgba(0,0,0,.45);}
.module-title{line-height:1.2;margin-bottom:.5rem;word-break:break-word;}
.module-subtitle{color:#bbb;font-weight:500;font-size:.95rem;letter-spacing:.02em;}
.module-desc-wrap{flex:1;display:flex;align-items:center;margin:.5rem 0;}

.module-actions{
  display:flex;
  align-items:center;
  gap:.6rem;
  justify-content:flex-start;
  flex-wrap:nowrap;
  padding-top:.25rem;
  margin-top:auto;
}
.module-actions .btn-pill,
.module-actions .btn-disabled{
  flex:1 1 0;
  min-width:0;
  max-width:100%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.5rem .9rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.module-actions .btn-disabled{
  background:#1a1a1a;
  border:1px solid #2a2a2a;
  color:#888;
  border-radius:999px;
}
.module-actions .btn-circle{flex:0 0 44px;}

.badge-version{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.02em;
  padding:.25rem .55rem;
  border-radius:999px;
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  color:#fff;
  box-shadow:0 6px 18px rgba(255,123,0,.18);
  white-space:nowrap;
}
.badge-version .dot{width:.5rem;height:.5rem;border-radius:50%;background:#fff;opacity:.9;}

.price{font-weight:700;}
.price-old{color:#aaa;text-decoration:line-through;margin-right:.5rem;}
.price-new{color:#ff7b00;}
.price-free{color:#4caf50;font-weight:600;}

.meta-inline{font-size:.85rem;color:#bbb;display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;}
.meta-sep{opacity:.4;}

.thumb-wrap{
  position:relative;
  cursor:pointer;
  margin-bottom:.75rem;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
  background:#0f0f0f;
}
.thumb-wrap:hover{border-color:rgba(255,123,0,.35);}
.module-thumb{width:100%;height:180px;object-fit:cover;display:block;}
.thumb-placeholder{display:flex;align-items:center;justify-content:center;height:180px;}
.thumb-placeholder span{font-size:3rem;line-height:1;color:#777;}

.media-16x9{
  aspect-ratio:16/9;
  width:100%;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
  background:#0b0b0b;
}
.media-16x9 img{width:100%;height:100%;object-fit:cover;display:block;}

.search-card{
  background:#111;
  border-radius:16px;
  padding:1rem 1rem 1.25rem;
  box-shadow:0 8px 28px rgba(0,0,0,.4);
  margin-bottom:1.25rem;
  --seg-h:var(--control-h);
  --search-min:280px;
  --filters-min:340px;
}
.search-input{background:#0c0c0c;border:1px solid #222;color:#fff;border-radius:12px;}
.search-input::placeholder{color:#777;}
.search-meta{color:#aaa;}
.search-card .row{align-items:stretch!important;}
.search-card .search-input.form-control-lg{height:var(--control-h);}
.search-card .input-group>.btn-pill{
  height:var(--control-h);
  padding:0 1rem;
  display:inline-flex;
  align-items:center;
}
.search-card .input-group{flex:1 1 auto;min-width:0;}
.search-card .input-group .form-control{flex:1 1 auto;min-width:0;}
.search-card .input-group .btn-pill{flex:0 0 auto;white-space:nowrap;}

.price-seg{
  height:var(--control-h);
  padding:.2rem .25rem;
  display:inline-flex;
  align-items:center;
  gap:.3rem;
  background:#0c0c0c;
  border:1px solid #222;
  border-radius:999px;
  flex:1 1 auto;
  min-width:0;
  max-width:100%;
}
.price-seg .seg-btn{
  appearance:none;
  -webkit-appearance:none;
  border:none;
  cursor:pointer;
  padding:0 .68rem;
  height:calc(var(--control-h) - .5rem);
  border-radius:999px;
  font-weight:600;
  letter-spacing:.01em;
  background:transparent;
  color:#aaa;
  transition:all .15s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}
.price-seg .seg-btn:hover{color:#fff;}
.price-seg .seg-btn.active{
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  color:#fff;
  box-shadow:0 6px 18px rgba(255,123,0,.25);
}

.btn-circle{
  width:44px;
  height:44px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#121212;
  border:1px solid #2a2a2a;
  color:#ff7b00;
  font-size:1.05rem;
  transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;
  cursor:pointer;
}
.btn-circle svg{width:20px;height:20px;fill:currentColor;}
.btn-circle:hover{border-color:#ff7b00;box-shadow:0 0 0 3px rgba(255,123,0,.15);}
.btn-circle:active{transform:scale(.95);}
.btn-circle.active{
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  border-color:transparent;
  color:#fff;
  box-shadow:0 6px 18px rgba(255,123,0,.25);
}
.btn-circle.active svg{fill:#fff;}

.btn-pill{
  appearance:none;
  -webkit-appearance:none;
  border:none;
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  color:#fff!important;
  border-radius:999px;
  padding:.55rem 1.05rem;
  font-weight:600;
  letter-spacing:.01em;
  text-decoration:none!important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.45rem;
  transition:transform .06s ease, box-shadow .2s ease, opacity .2s ease;
  box-shadow:0 6px 18px rgba(255,123,0,.25);
  cursor:pointer;
  user-select:none;
}
.btn-pill:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(255,123,0,.35);}
.btn-pill:active{transform:translateY(0);box-shadow:0 6px 18px rgba(255,123,0,.25) inset;}
.btn-pill:focus{outline:none;box-shadow:0 0 0 3px rgba(255,123,0,.3),0 8px 26px rgba(0,0,0,.35);}

#modulesGrid .module-card .line-meta .btn-inline{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  margin-left:auto!important;
  font-size:.78rem!important;
  font-weight:700!important;
  letter-spacing:.02em!important;
  line-height:1!important;
  border-radius:999px!important;
  box-shadow:0 6px 18px rgba(255,123,0,.18)!important;
}

.modal-dialog{max-width:1100px;}
.modal-content.modal-dark{
  background:#1f1f1f!important;
  color:#fff;
  border:0!important;
  border-radius:16px;
  box-shadow:0 20px 60px rgba(0,0,0,.7);
  padding:0 1rem;
}
.modal-content.modal-dark .modal-header,
.modal-content.modal-dark .modal-footer{border:0!important;}
.modal-content.modal-dark .modal-title{color:#ffa726;font-weight:800;font-size:1.8rem;}
.modal-content.modal-dark .btn-close{filter:invert(1) grayscale(100%);opacity:.9;}
.modal-backdrop.show{background:#000;opacity:.84;}
.modal-desc{
  color:#ddd;
  line-height:1.65;
  font-size:1rem;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.modal-dark{background:#1f1f1f;color:#e5e5e5;border-radius:14px;}
.modal-dark .form-control{background:#151515;border-color:#2b2b2b;color:#fff;}
.modal-dark .btn-close{filter:invert(1);}

.hint{color:#aaa;font-size:.85rem;}

.badge-free{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.25rem .55rem;
  border-radius:999px;
  font-weight:700;
  background:rgba(46,204,113,.12);
  border:1px solid rgba(46,204,113,.35);
  color:#a6f3c5;
  font-size:.78rem;
  letter-spacing:.02em;
  white-space:nowrap;
}
.badge-free .dot{width:.5rem;height:.5rem;border-radius:50%;background:#2ecc71;display:inline-block;}

.badge-unknown{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.25rem .55rem;
  border-radius:999px;
  font-weight:700;
  background:rgba(200,200,200,.12);
  border:1px solid rgba(200,200,200,.25);
  color:#ccc;
  font-size:.78rem;
  letter-spacing:.02em;
  white-space:nowrap;
}
.badge-unknown .dot{width:.5rem;height:.5rem;border-radius:50%;background:#aaa;display:inline-block;}

rating-line{display:flex;align-items:center;gap:.45rem;}
.stars{display:inline-flex;gap:.15rem;line-height:1;}
.stars .star{font-size:1.1rem;opacity:.45;transition:opacity .15s ease,transform .08s ease;}
.stars .star.filled{opacity:1;}
.stars.interactive .star{cursor:pointer;}
.stars.interactive .star:hover{transform:scale(1.1);}
.rating-count{color:#aaa;font-weight:600;font-size:.95rem;}
.modal-dark .stars .star{font-size:1.35rem;}

review-hint{color:#aaa;font-size:.9rem;}
.form-control-dark{background:#0f0f0f;border:1px solid #2a2a2a;color:#fff;}
.form-control-dark:focus{background:#0f0f0f;border-color:#ff7b00;box-shadow:0 0 0 3px rgba(255,123,0,.15);}

.reviews-modal .modal-content{background:#151515;border:1px solid #2a2a2a;}
.reviews-modal .modal-title{color:#ffa14a;}
.reviews-modal .text-muted{color:#bbb!important;}
.reviews-modal [data-role="reviews-container"]{display:flex;flex-direction:column;gap:.75rem;min-height:5.5rem;}
.reviews-modal .review-item{background:#0f0f0f;border:1px solid #2a2a2a;border-radius:12px;padding:.85rem 1rem;}
.reviews-modal .review-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:.35rem;}
.reviews-modal .review-author{font-weight:700;color:#fff;}
.reviews-modal .review-date{color:#9aa3aa;font-size:.9rem;white-space:nowrap;margin-left:1rem;}
.reviews-modal .review-text{color:#ddd;white-space:pre-wrap;}
.reviews-modal .stars{gap:.2rem;}
.reviews-modal .stars .star{font-size:1.15rem;color:#ff7b00;opacity:.35;}
.reviews-modal .stars .star.filled{opacity:1;}

#toastArea{position:fixed;right:16px;bottom:16px;z-index:1080;}

#modulesGrid .module-card{
  height:var(--module-card-height);
  display:flex;
  flex-direction:column;
  padding:0;
  overflow:hidden;
}
#modulesGrid .module-card>.thumb-wrap{
  margin:0;
  border-radius:16px 16px 0 0;
  border:0;
  background:#0f0f0f;
  flex:0 0 var(--module-thumb-height);
  height:var(--module-thumb-height);
}
#modulesGrid .module-card .module-thumb{width:100%;height:100%;object-fit:cover;display:block;}
#modulesGrid .module-card .thumb-placeholder{height:100%;}
#modulesGrid .module-card .thumb-placeholder span{height:auto;}

#modulesGrid .module-card .card-inner{
  display:grid;
  grid-template-rows:auto auto auto auto auto 1fr;
  row-gap:.55rem;
  padding:1rem 1rem .75rem;
  min-height:0;
  flex:1 1 auto;
}
#modulesGrid .module-card .module-title{
  font-size:1.05rem;font-weight:800;color:#fff;margin:0;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  --title-rows:2;line-height:var(--row-lh);
  min-height:calc(var(--title-rows) * var(--row-lh) * 1em);
  max-height:calc(var(--title-rows) * var(--row-lh) * 1em);
}
#modulesGrid .module-card .line-rating{
  display:flex;align-items:center;gap:.45rem;
  line-height:var(--row-lh);
  min-height:var(--row-h);max-height:var(--row-h);
}
#modulesGrid .module-card .stars{line-height:1;}
#modulesGrid .module-card .stars .star{line-height:1;display:inline-block;}

#modulesGrid .module-card .line-meta{
  display:flex;
  align-items:center;
  gap:.5rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:var(--row-lh);
  min-height:var(--row-h-meta);
  max-height:var(--row-h-meta);
}
#modulesGrid .module-card .line-meta>*{flex:0 0 auto;min-width:0}
#modulesGrid .module-card .line-meta .module-subtitle{
  flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}

#modulesGrid .module-card .line-price{
  display:flex;align-items:center;gap:.35rem;
  line-height:var(--row-lh);
  min-height:var(--row-h);max-height:var(--row-h);
}
#modulesGrid .module-card .module-desc-wrap{min-height:0;display:flex;}
#modulesGrid .module-card .module-desc{-webkit-line-clamp:3;}
#modulesGrid .module-card .module-footer{margin-top:auto;padding:0 1rem 1rem;}
#modulesGrid .module-card .module-actions{padding:0;margin:0;}

review-modal .stars.interactive .star{font-size:2rem;line-height:1;cursor:pointer;}
.stars.readonly .star{font-size:1rem;}

side-cover{
  width:100%;
  aspect-ratio:16/10;
  background:#0f0f0f;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.side-cover-img{width:100%;height:100%;object-fit:cover;display:block;}
.side-cover-placeholder{font-size:3rem;opacity:.8;}

.side-prices .price{display:inline-block;margin-right:.6rem;font-weight:700;font-size:1.15rem;}
.side-prices .price-old{text-decoration:line-through;opacity:.65;}
.side-prices .price-new{
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}

.list-versions{list-style:none;margin:0;padding:0;display:grid;gap:.5rem;}
.list-versions-item{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:.75rem;
  padding:.5rem .75rem;
  background:#0f0f0f;
  border:1px solid #1f1f1f;
  border-radius:10px;
}
.ver-chip{padding:.2rem .5rem;border-radius:999px;background:#1b1b1b;border:1px solid #2a2a2a;font-weight:700;font-size:.9rem;}
.ver-date{color:#aaa;font-size:.9rem;}
.ver-download{text-decoration:none;font-weight:600;color:#fff;}
.ver-download:hover{text-decoration:underline;}

.reviews-mini{display:grid;gap:.75rem;}

@media (min-width:992px){
  .module-actions{flex-wrap:nowrap!important;}
  .modal-lg{max-width:1100px;}
  .price-seg{flex-wrap:nowrap;}
}

@media (max-width:576px){
  #modulesGrid .module-card{height:auto!important;padding:0!important;}
  #modulesGrid .module-card .card-inner{padding:.85rem .9rem .5rem!important;}
  #modulesGrid .module-card .module-title{font-size:1rem;line-height:1.3;-webkit-line-clamp:2;min-height:0;max-height:none;}
  #modulesGrid .module-card .line-rating,
  #modulesGrid .module-card .line-price{min-height:0;max-height:none;line-height:1.3;}
  #modulesGrid .module-card .line-meta{
    white-space:normal;min-height:0;max-height:none;overflow:visible;flex-wrap:wrap;gap:.4rem
  }
  #modulesGrid .module-card .line-meta .module-subtitle{white-space:normal}
  #modulesGrid .module-card .line-meta .btn-inline{
    margin-left:0!important;
  }
  #modulesGrid .module-card .module-footer{padding:0 .9rem .9rem!important;}
  .module-actions{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 38px 38px;gap:.45rem;align-items:stretch;}
  .module-actions .btn-pill,
  .module-actions .btn-disabled{min-width:0;padding:.55rem .7rem;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .module-actions .btn-circle{width:38px;height:38px;flex:none;}
  .module-actions .btn-circle svg{width:18px;height:18px;}
  #modulesGrid .module-card .module-desc{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;line-height:1.45;font-size:.95rem;max-height:calc(1.45em * 3);}
  #modulesGrid .module-card .module-desc-wrap{min-height:calc(1.45em * 3);}
  #modulesGrid .module-card .module-desc-box{position:relative!important;padding:.7rem .9rem!important;border-radius:12px!important;min-height:auto!important;font-family:inherit!important;white-space:normal!important;overflow:hidden!important;}
  #modulesGrid .module-card .module-desc-box::after{content:"";position:absolute;left:0;right:0;bottom:0;height:1.1em;background:linear-gradient(to bottom,rgba(42,42,42,0),rgba(42,42,42,1));pointer-events:none;}
}

@media (min-width:992px){
  .search-card .row{ display:flex; flex-wrap:nowrap; align-items:center; }
  .search-card .col-search{ flex:1 1 auto; min-width:220px; }
  .search-card .col-filters{ flex:0 0 auto; }
  .search-card .input-group{ min-width:0; }
  #priceSeg{ flex:0 0 auto; white-space:nowrap; }
}

.price-seg{
  position:relative;
  height:var(--control-h);
  padding:4px;
  gap:0;
  overflow:hidden;
  border-radius:999px;
}
.price-seg .seg-btn{
  position:relative;
  z-index:0;
  flex:0 0 auto;
  height:calc(var(--control-h) - 8px);
  line-height:calc(var(--control-h) - 8px);
  padding:0 clamp(.5rem, 1vw, .9rem);
  border-radius:999px;
  background:transparent;
  color:#aaa;
  font-weight:600;
  letter-spacing:.01em;
  display:flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  transition:all .15s ease;
}
.price-seg .seg-btn:hover{ color:#fff; }
.price-seg .seg-btn.active{
  background:linear-gradient(135deg,#ff7b00,#ff5500);
  color:#fff;
  box-shadow:0 6px 18px rgba(255,123,0,.25);
}
.price-seg .seg-btn:last-child{
  border-top-right-radius:999px;
  border-bottom-right-radius:999px;
}

/* унификация высоты и типографики для «Войти» и «версии» */
#modulesGrid .module-card .line-meta .btn-inline,
.badge-version{
  height:var(--chip-h) !important;
  min-height:var(--chip-h) !important;
  max-height:var(--chip-h) !important;
  padding:0 var(--chip-px) !important;
  font:700 .78rem/1 'Roboto',sans-serif !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:999px !important;
}

/* стиль кнопки «Войти» */
#modulesGrid .module-card .line-meta .btn-inline{
  background:linear-gradient(135deg,#ff7b00,#ff5500)!important;
  color:#fff!important;
  box-shadow:0 6px 18px rgba(255,123,0,.18)!important;
  border:0 !important;
}

/* нормализация для разных платформ */
#modulesGrid .module-card .line-meta .btn-inline,
#modulesGrid .module-card .line-meta .btn-inline:link,
#modulesGrid .module-card .line-meta .btn-inline:visited{
  -webkit-appearance:none;
  appearance:none;
  white-space:nowrap !important;
  text-decoration:none !important;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
button.btn-inline::-moz-focus-inner{border:0;padding:0;}

/* точка внутри версии */
.badge-version .dot{
  width:.5rem;
  height:.5rem;
  border-radius:50%;
  flex:0 0 .5rem;
  align-self:center;
}
