/*
 * Редизайн топ-3 (сайдбар / мобильный / контент) — из obzor-demo-trade-reference.
 * Подключается после style.css и review-single.css.
 */

/* ---------- .rating-stars — пять звёзд с дробной заливкой ---------- */
.rating-stars-block { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 5px; }
.rating-stars {
  --star-size: 18px; --star-gap: 2px; --rating: 0;
  position: relative; display: inline-block; flex-shrink: 0;
  width: calc(var(--star-size) * 5 + var(--star-gap) * 4); height: var(--star-size);
}
.rating-stars::before, .rating-stars::after {
  content: ""; position: absolute; inset: 0; background-color: var(--yellow, #f8c51b);
}
.rating-stars::before {
  -webkit-mask: url("../assets/images/star.svg") left center / var(--star-size) var(--star-size) space no-repeat;
  mask: url("../assets/images/star.svg") left center / var(--star-size) var(--star-size) space no-repeat;
}
.rating-stars::after {
  -webkit-mask: url("../assets/images/star-fill.svg") left center / var(--star-size) var(--star-size) space no-repeat;
  mask: url("../assets/images/star-fill.svg") left center / var(--star-size) var(--star-size) space no-repeat;
  clip-path: inset(0 calc(100% - var(--rating) * 20%) 0 0);
}
.rating-stars--value { font-size: 14px; font-weight: 700; line-height: 1; color: var(--dark, #202027); }
.rating-stars-sm { --star-size: 14px; --star-gap: 2px; }

/* ---------- место в топ-3: кружок .place-badge и кубок .place-cup ---------- */
.place-badge {
  --pb-size: 26px; --pb-a: var(--medal-gold, #ffd965); --pb-b: var(--medal-gold-deep, #f4bb66);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--pb-size); height: var(--pb-size); border-radius: 50%;
  font-size: calc(var(--pb-size) * 0.52); font-weight: 800; line-height: 1; letter-spacing: 0; color: var(--dark, #202027);
  background: linear-gradient(160deg, var(--pb-a), var(--pb-b));
  box-shadow: 0 0 0 2px var(--white, #fff), 0 2px 6px rgba(32, 32, 39, 0.28);
}
.place-badge-2 { --pb-a: var(--medal-silver-light, #c9cdd2); --pb-b: var(--medal-silver, #848482); }
.place-badge-3 { --pb-a: var(--medal-bronze-light, #e8bf96); --pb-b: var(--medal-bronze, #cc9966); }

.place-cup {
  --cup-size: 28px; --cup-a: var(--medal-gold, #ffd965); --cup-b: var(--medal-gold-deep, #f4bb66);
  position: relative; isolation: isolate; display: inline-flex; justify-content: center; flex-shrink: 0;
  width: var(--cup-size); height: var(--cup-size); padding-top: calc(var(--cup-size) * 0.17);
  font-size: calc(var(--cup-size) * 0.34); font-weight: 800; line-height: 1; letter-spacing: 0;
  color: var(--dark, #202027);
  filter: drop-shadow(0 1px 1px rgba(32, 32, 39, 0.28));
}
.place-cup::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(160deg, var(--cup-a), var(--cup-b));
  -webkit-mask: url("../assets/images/redesign/cup.svg") center / contain no-repeat;
  mask: url("../assets/images/redesign/cup.svg") center / contain no-repeat;
}
.place-cup-2 { --cup-a: var(--medal-silver-light, #c9cdd2); --cup-b: var(--medal-silver, #848482); }
.place-cup-3 { --cup-a: var(--medal-bronze-light, #e8bf96); --cup-b: var(--medal-bronze, #cc9966); }

/* ---------- кнопки топ-3 ---------- */
.btn.btn-gradient {
  gap: 6px; color: var(--blue-ink, #0b2c8f) !important;
  background-color: var(--blue-sky, #57b0ff);
  background-image: linear-gradient(100deg, var(--blue-sky-light, #cfe7ff) 0%, var(--blue-sky, #57b0ff) 100%);
  transition: filter 0.2s ease-in-out;
}
.btn.btn-gradient:hover, .btn.btn-gradient:active, .btn.btn-gradient.active {
  background-color: var(--blue-sky, #57b0ff); filter: brightness(0.95) saturate(1.2);
}
.btn.btn-shine {
  background-image: linear-gradient(100deg, transparent 0%, transparent 43%, var(--medal-gold, #ffd965) 50%, transparent 57%, transparent 100%);
  background-size: 300% 100%; background-repeat: no-repeat; background-position: 130% 0;
  animation: vi-shine 3.2s ease-in-out infinite;
}
@keyframes vi-shine { 0% { background-position: 130% 0; } 45%, 100% { background-position: -30% 0; } }
.btn.btn-gradient:focus-visible, .btn.btn-shine:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 2px; }
.btn-emoji { flex-shrink: 0; font-size: 1.05em; line-height: 1; }

.btn.btn-reviews { position: relative; }
.btn-reviews--main { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-reviews--new { display: none; }
@keyframes vi-pop { 0%, 100% { transform: scale(1) rotate(3deg); } 50% { transform: scale(1.12) rotate(-2deg); } }
.btn-reviews-new .btn-reviews--new {
  display: block; position: absolute; top: -9px; right: -6px; padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 800; line-height: 1.4; letter-spacing: 0; color: var(--dark, #202027);
  background: linear-gradient(160deg, var(--medal-gold, #ffd965), var(--medal-gold-deep, #f4bb66));
  box-shadow: 0 2px 8px rgba(32, 32, 39, 0.35); animation: vi-pop 1.8s ease-in-out infinite;
}

.btn.btn-arrow { flex: 0 0 auto; width: 40px; min-width: 40px; padding: 0; }
.btn.btn-arrow svg { display: block; width: 18px; height: 18px; transition: transform 0.15s ease-in-out; }
.btn.btn-arrow:hover svg { transform: translateX(2px); }

.btn.btn-soft {
  color: var(--blue, #1458dd) !important; background-color: var(--white, #fff);
  background-image: linear-gradient(180deg, var(--white, #fff) 0%, var(--white, #fff) 35%, var(--blue-sky-light, #cfe7ff) 100%);
  box-shadow: inset 0 0 0 1px var(--blue-sky, #57b0ff), inset 0 1px 0 2px var(--white, #fff);
  transition: filter 0.2s ease-in-out;
}
.btn.btn-soft:hover, .btn.btn-soft:active, .btn.btn-soft.active {
  background-color: var(--white, #fff); filter: brightness(0.97) saturate(1.3);
}
.btn.btn-soft:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 2px; }

/* ---------- плашка статуса ---------- */
.status-plate { position: relative; isolation: isolate; width: fit-content; padding: 5px 16px 5px 10px; line-height: 1.3; }
.status-plate::after {
  content: ""; position: absolute; inset: -1px -3px; z-index: -1; background: var(--white, #fff); transform: rotate(-2.5deg);
  -webkit-mask: url("../assets/images/redesign/tape.svg") center / 100% 100% no-repeat;
  mask: url("../assets/images/redesign/tape.svg") center / 100% 100% no-repeat;
}

/* ---------- анимации ---------- */
@keyframes vi-twinkle { 0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; } 50% { transform: scale(1.22) rotate(14deg); opacity: 0.75; } }
@keyframes vi-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes vi-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes vi-glow-gold { 0%, 100% { box-shadow: 0 0 0 0 var(--medal-gold, #ffd965); } 50% { box-shadow: 0 0 22px 2px var(--medal-gold, #ffd965); } }
@keyframes vi-drift { 0% { transform: translate(-6%, -4%) rotate(0deg); } 100% { transform: translate(6%, 5%) rotate(10deg); } }
@keyframes vi-paint { 0%, 10% { clip-path: inset(0 100% 0 0); } 45%, 100% { clip-path: inset(0 0 0 0); } }

/* ---------- заголовок виджета топ-3 ---------- */
.widget .widget-head.widget-head-gold {
  position: relative; justify-content: center; padding: 16px 15px 18px;
  background: var(--white, #fff); border-top: 2px solid var(--medal-gold-deep, #f4bb66); border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.widget .widget-head.widget-head-gold::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, var(--medal-gold-deep, #f4bb66), var(--medal-gold, #ffd965), var(--medal-gold-deep, #f4bb66));
}
.widget .widget-head.widget-head-gold p {
  display: inline-flex; align-items: center; gap: 14px; font-size: 20px; font-weight: 800; line-height: 1.3; color: var(--dark, #202027);
}
.widget-head:not(.widget-head-gold) .widget-head--star { display: none; }
.widget-head--star { display: inline-block; font-size: 0.9em; line-height: 1; animation: vi-bob 1.8s ease-in-out infinite; }
.widget-head-gold .widget-head--text { position: relative; isolation: isolate; padding: 1px 4px; }
.widget-head-gold .widget-head--text::before {
  content: ""; position: absolute; inset: -3px -9px -4px; z-index: -1; transform: rotate(-1.5deg);
  background: linear-gradient(90deg, var(--medal-gold, #ffd965), var(--medal-gold-deep, #f4bb66));
  -webkit-mask: url("../assets/images/redesign/brush.svg") center / 100% 100% no-repeat;
  mask: url("../assets/images/redesign/brush.svg") center / 100% 100% no-repeat;
  animation: vi-paint 4.5s ease-in-out infinite alternate;
}

/* ---------- виджет «Топ трейдеров»: .widget-top ---------- */
.widget-top .widget-row { flex-wrap: wrap; gap: 10px 12px; padding: 14px 10px; }
.widget-top .widget-row .widget-exchanges--info { flex: 999 1 170px; min-width: 0; gap: 8px; }
.widget-top .widget-row .widget-exchanges--info > div { min-width: 0; gap: 3px; }
.widget-top--pic { position: relative; flex-shrink: 0; margin-left: 12px; }
.widget-top--pic figure { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--blue-light, #eef3ff); }
.widget-top .widget-row .widget-exchanges--info .widget-top--pic img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
.widget-top--pic .place-badge { position: absolute; top: -5px; left: -12px; z-index: 1; }
.widget-top .rating-stars { --star-size: 18px; --star-gap: 2px; }
.widget-row--actions { display: flex; flex-direction: column; gap: 6px; flex: 1 0 96px; }
.widget-row--actions .btn { width: 100%; min-width: 0; padding: 3px 8px; white-space: nowrap; }
.widget-top .widget-row:nth-child(2) .btn-shine { animation-delay: 0.5s; }
.widget-top .widget-row:nth-child(3) .btn-shine { animation-delay: 1s; }

/* ---------- блок в статье: .top-traders ---------- */
.top-traders {
  --tt-a: var(--medal-gold, #ffd965); --tt-b: var(--medal-gold-deep, #f4bb66); --tt-card: #2b2b34;
  position: relative; isolation: isolate; overflow: hidden;
  margin: 7px 0; padding: 24px 20px; border-radius: 16px;
  font-size: 14px; line-height: 1.5; color: var(--white, #fff); background: var(--dark, #202027);
}
.top-traders::before {
  content: ""; position: absolute; inset: -35%; z-index: -1; opacity: 0.55;
  background:
    radial-gradient(closest-side, var(--blue, #1458dd), transparent) 10% 15% / 55% 55% no-repeat,
    radial-gradient(closest-side, var(--blue-sky, #57b0ff), transparent) 92% 30% / 38% 38% no-repeat,
    radial-gradient(closest-side, var(--blue-dark, #1234e3), transparent) 55% 95% / 50% 50% no-repeat;
  animation: vi-drift 10s ease-in-out infinite alternate;
}
.top-traders--head { display: flex; justify-content: center; margin-bottom: 22px; text-align: center; }
.top-traders--title { display: block; font-size: 22px; font-weight: 800; line-height: 1.3; color: var(--medal-gold, #ffd965); text-wrap: balance; }
.top-traders--star { display: inline-block; margin-right: 8px; line-height: 1; animation: vi-twinkle 2.4s ease-in-out infinite; }
.top-traders--title-text {
  background: linear-gradient(100deg, var(--medal-gold, #ffd965) 0%, var(--medal-gold, #ffd965) 40%, var(--white, #fff) 50%, var(--medal-gold, #ffd965) 60%, var(--medal-gold, #ffd965) 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; animation: vi-shimmer 4s linear infinite;
}
.top-traders--list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.top-traders--item {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0;
  padding: 18px 16px 16px; border: 2px solid transparent; border-radius: 16px; text-align: left;
  background: linear-gradient(var(--tt-card), var(--tt-card)) padding-box, linear-gradient(160deg, var(--tt-a), var(--tt-card) 55%, var(--tt-b)) border-box;
  transition: transform 0.2s ease-in-out;
}
.top-traders--item:hover { transform: translateY(-4px); }
.top-traders--item-1 { animation: vi-glow-gold 2.8s ease-in-out infinite; }
.top-traders--item-2 { --tt-a: var(--medal-silver-light, #c9cdd2); --tt-b: var(--medal-silver, #848482); }
.top-traders--item-3 { --tt-a: var(--medal-bronze-light, #e8bf96); --tt-b: var(--medal-bronze, #cc9966); }
.top-traders--place { position: absolute; top: 14px; right: 14px; display: flex; }
.top-traders .place-cup { --cup-size: 44px; }
.top-traders--avatar {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; overflow: hidden;
  background: var(--blue-light, #eef3ff); box-shadow: 0 0 0 2px var(--tt-card), 0 0 0 4px var(--tt-a);
}
.top-traders--avatar a { display: block; width: 100%; height: 100%; }
.top-traders--avatar img { width: 100%; height: 100%; object-fit: cover; }
.top-traders--info { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; max-width: 100%; }
.top-traders .top-traders--name {
  font-size: 18px; font-weight: 800; line-height: 1.3; color: var(--white, #fff);
  overflow-wrap: anywhere; transition: color 0.12s ease-in-out;
}
.top-traders .top-traders--name:hover { color: var(--medal-gold, #ffd965); }
.top-traders .rating-stars { --star-size: 22px; --star-gap: 3px; }
.top-traders .rating-stars--value { color: var(--white, #fff); }
.top-traders .status-plate { margin-top: 3px; font-size: 14px; }
.top-traders--actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: auto; padding-top: 4px; }
.top-traders .top-traders--actions .btn {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; font-size: 14px; white-space: nowrap;
}
.top-traders--item:nth-child(2) .btn-shine { animation-delay: 0.5s; }
.top-traders--item:nth-child(3) .btn-shine { animation-delay: 1s; }

/* ---------- подсказка «Есть негативные»: .negative-hint ---------- */
@keyframes vi-alarm {
  0%, 58%, 100% { transform: rotate(0deg) scale(1); }
  62% { transform: rotate(-6deg) scale(1.08); } 66% { transform: rotate(6deg) scale(1.08); }
  70% { transform: rotate(-5deg) scale(1.08); } 74% { transform: rotate(5deg) scale(1.08); }
  78% { transform: rotate(-3deg) scale(1.04); } 84% { transform: rotate(0deg) scale(1); }
}
@keyframes vi-ping { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(1.25, 1.75); opacity: 0; } }
.negative-hint {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; align-self: flex-start; gap: 6px; margin: 8px 0 0; vertical-align: middle;
  padding: 4px 11px 4px 5px; border-radius: 100px;
  font-size: 12px; font-weight: 700; line-height: 1.35; letter-spacing: 0; white-space: nowrap;
  color: var(--white, #fff) !important; text-decoration: none !important; background: var(--red-dark, #b3262f);
  box-shadow: 0 4px 14px rgba(32, 32, 39, 0.35);
  transform-origin: 20px top; animation: vi-alarm 2.6s ease-in-out infinite;
}
.negative-hint::before { content: ""; position: absolute; left: 16px; top: -4px; z-index: -1; width: 10px; height: 10px; border-radius: 2px; background: inherit; transform: rotate(45deg); }
.negative-hint::after { content: ""; position: absolute; inset: 0; z-index: -2; border-radius: inherit; border: 2px solid var(--red, #ec5962); animation: vi-ping 1.3s ease-out infinite; }
.negative-hint--icon { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; font-size: 12px; font-weight: 800; line-height: 1; color: var(--red-dark, #b3262f); background: var(--white, #fff); }
.hero .hero-section-1 .hero-section-1--right-info:has(.negative-hint) { padding-right: 30px; }
.negative-hint:hover { background: var(--red, #ec5962); }
.negative-hint:focus-visible { outline: 2px solid var(--white, #fff); outline-offset: 2px; }

/* ---------- «Краткий вывод редакции»: .editor-alert ---------- */
.editor-alert {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  margin: -7px 0 20px; padding: 20px 56px 20px 20px; border-radius: 16px;
  color: var(--dark, #202027); background: var(--red-light, #fdf2f2);
  border: 1px solid color-mix(in srgb, var(--red, #ec5962) 55%, var(--white, #fff));
}
.editor-alert--icon {
  position: absolute; top: 18px; right: 18px; width: 26px; height: 26px;
  background-color: var(--red-dark, #b3262f);
  -webkit-mask: url("../assets/images/redesign/warning.svg") center / contain no-repeat;
  mask: url("../assets/images/redesign/warning.svg") center / contain no-repeat;
}
.editor-alert--tag {
  padding: 3px 12px; border-radius: 100px; font-size: 12px; font-weight: 700; line-height: 1.5;
  color: var(--red-dark, #b3262f); background: color-mix(in srgb, var(--red, #ec5962) 18%, var(--white, #fff));
}
.editor-alert--title { font-size: 18px; font-weight: 800; line-height: 1.3; color: var(--red-dark, #b3262f); }
.editor-alert--text { font-size: 14px; line-height: 1.6; max-width: 940px; }
.editor-alert.editor-alert-inline { margin: 20px 0; }
@media (min-width: 976px) {
  .editor-alert { margin: -16px 0 29px; padding: 22px 64px 24px 24px; }
  .editor-alert--text { font-size: 16px; }
  .editor-alert.editor-alert-inline { margin: 33px 0 0; }
  .editor-alert-inline + a + .cta { margin-top: 33px; }
}

/* ---------- «В той же категории есть проект…»: .better-project ---------- */
@keyframes vi-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
.better-project {
  position: relative; margin: 20px 0; padding: 20px 24px 24px;
  border-radius: 16px; font-size: 14px; line-height: 1.5; color: var(--dark, #202027);
  background: linear-gradient(150deg, var(--blue-light, #eef3ff) 0%, var(--white, #fff) 70%);
  border: 1px solid var(--blue-line, #e5eaff);
  overflow: visible;
}
.better-project--top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
.better-project--label {
  font-size: 11px; font-weight: 800; line-height: 1.4; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--blue, #1458dd);
}
.better-project--why-wrap { position: relative; display: inline-flex; flex-shrink: 0; z-index: 3; }
.better-project .better-project--why {
  appearance: none; border: 0; background: transparent !important; padding: 0; margin: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 500; line-height: 1.4;
  color: var(--grey, #5b6871) !important; text-decoration: underline; text-underline-offset: 3px;
  box-shadow: none !important;
}
.better-project .better-project--why:hover,
.better-project .better-project--why:focus,
.better-project .better-project--why:active {
  color: var(--dark, #202027) !important; background: transparent !important;
}
.better-project .better-project--why:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 2px; }
.better-project--why-tip {
  position: absolute; right: 0; bottom: calc(100% + 12px); z-index: 30;
  box-sizing: border-box; width: min(300px, calc(100vw - 40px));
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--grey-line, #dde2e4);
  font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--grey, #5b6871);
  text-align: left; white-space: normal; overflow-wrap: break-word; word-wrap: break-word;
  background: var(--white, #fff);
  box-shadow: 0 8px 24px rgba(32, 32, 39, 0.12);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  pointer-events: none;
}
.better-project--why-tip::after {
  content: ""; position: absolute; right: 22px; bottom: -6px; z-index: 1;
  width: 12px; height: 12px; background: var(--white, #fff);
  border: solid var(--grey-line, #dde2e4); border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}
.better-project--why-wrap.is-open .better-project--why-tip {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
}
.better-project--why-tip[hidden] { display: block !important; }
.better-project--body {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 18px 24px;
}
.better-project--pic { width: 110px; height: 110px; margin: 0; }
.better-project--pic img { width: 100%; height: 100%; object-fit: contain; }
.better-project--title { margin-bottom: 6px; font-size: 20px; font-weight: 800; line-height: 1.3; text-wrap: balance; }
.better-project--score { white-space: nowrap; color: var(--blue, #1458dd); }
.better-project--desc { font-size: 14px; }
.better-project .better-project--link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 9px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 700; color: var(--white, #fff); background: var(--blue, #1458dd);
  transition: all 0.12s ease-in-out;
}
.better-project .better-project--link:hover { color: var(--white, #fff); background: var(--blue-dark, #1234e3); }
.better-project .better-project--link:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 2px; }
.better-project--arrow { display: inline-block; animation: vi-nudge 1.4s ease-in-out infinite; }
.better-project--duel { display: flex; align-items: stretch; gap: 10px; min-width: 0; }
.better-project--side {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 128px; padding: 14px 10px; border-radius: 12px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--grey, #5b6871);
  background: var(--white, #fff); border: 1px solid var(--grey-line, #dde2e4);
}
.better-project--side b { font-size: 34px; font-weight: 800; line-height: 1; color: var(--grey, #5b6871); }
.better-project--side.is-best {
  color: var(--dark, #202027); border: 2px solid var(--medal-gold-deep, #f4bb66);
  animation: vi-glow-gold 2.8s ease-in-out infinite;
}
.better-project--side.is-best b { color: var(--dark, #202027); }

/* ---------- плавающая кнопка «Оставьте отзыв»: .review-fab ---------- */
@keyframes vi-fab-ring { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes vi-fab-wiggle { 0%, 60%, 100% { transform: rotate(0deg) scale(1); } 68% { transform: rotate(-14deg) scale(1.12); } 76% { transform: rotate(12deg) scale(1.12); } 84% { transform: rotate(-8deg) scale(1.06); } 92% { transform: rotate(4deg) scale(1); } }
@keyframes vi-fab-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
.review-fab {
  position: fixed; right: 30px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 99990;
  display: flex; align-items: center; gap: 14px; transition: opacity 0.3s, visibility 0.3s;
}
.review-fab.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.review-fab--btn {
  position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(266.02deg, var(--blue, #1458dd) 0.64%, var(--blue-dark, #1234e3) 100%);
  box-shadow: 0 6px 20px rgba(20, 88, 221, 0.45);
}
.review-fab--btn::before, .review-fab--btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%;
  background: var(--blue, #1458dd); animation: vi-fab-ring 2.2s ease-out infinite;
}
.review-fab--btn::after { animation-delay: 1.1s; }
.review-fab .review-fab--btn .icon {
  width: 28px; height: 28px; background-color: var(--white, #fff);
  -webkit-mask-size: 26px 26px; mask-size: 26px 26px;
  animation: vi-fab-wiggle 2.6s ease-in-out infinite;
}
.review-fab--btn:hover { box-shadow: 0 6px 24px rgba(20, 88, 221, 0.65); }
.review-fab--btn:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 3px; }
.review-fab--count {
  position: absolute; top: -9px; right: -5px; min-width: 24px; padding: 2px 6px; border-radius: 100px;
  text-align: center; font-size: 11px; font-weight: 800; line-height: 1.4; letter-spacing: 0;
  color: var(--dark, #202027);
  background: linear-gradient(160deg, var(--medal-gold, #ffd965), var(--medal-gold-deep, #f4bb66));
  box-shadow: 0 0 0 2px var(--white, #fff);
}
.review-fab--bubble {
  position: relative; display: flex; align-items: center; gap: 4px; max-width: 280px;
  padding: 9px 6px 9px 14px; border-radius: 8px;
  background: var(--white, #fff); border: 1px solid var(--blue-line, #e5eaff);
  box-shadow: 0 6px 24px rgba(20, 88, 221, 0.18);
  animation: vi-fab-nudge 1.8s ease-in-out infinite;
}
.review-fab--bubble::after {
  content: ""; position: absolute; right: -6px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  background: var(--white, #fff); border: solid var(--blue-line, #e5eaff); border-width: 1px 1px 0 0;
  transform: rotate(45deg);
}
.review-fab.is-closed .review-fab--bubble { display: none; }
.review-fab .review-fab--text {
  font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--dark, #202027) !important;
  text-decoration: none !important;
}
.review-fab .review-fab--text b { font-weight: 800; color: var(--blue, #1458dd); white-space: nowrap; }
.review-fab .review-fab--text:hover b { text-decoration: underline; }
.review-fab--close {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  font-size: 18px; line-height: 1; color: var(--grey, #5b6871); transition: all 0.12s ease-in-out;
}
.review-fab--close:hover { color: var(--dark, #202027); background: var(--blue-light, #eef3ff); }
.review-fab--close:focus-visible { outline: 2px solid var(--blue, #1458dd); outline-offset: 1px; }
#comments-block { scroll-margin-top: calc(var(--nav-header-height, 70px) + 30px); }

/* ---------- топ-3 в сайдбаре: sticky на десктопе ---------- */
@media (min-width: 976px) {
  .main-content {
    align-items: flex-start;
  }
  .main-content-aside {
    position: sticky;
    top: calc(var(--nav-header-height, 70px) + 16px);
    align-self: flex-start;
  }
}

body:has(.review-fab) .btn-up { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); right: 33px; }
@media (min-width: 1470px) {
  .review-fab { right: 50%; margin-right: -700px; }
  body:has(.review-fab) .btn-up { right: 50%; margin-right: -697px; }
}
@media (max-width: 768px) {
  .review-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .review-fab--btn { width: 52px; height: 52px; }
  .review-fab--bubble { max-width: calc(100vw - 112px); }
  body:has(.review-fab) .btn-up { right: 22px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- закреплённый виджет на мобильном: .top-pin ---------- */
.top-pin { display: none; }
@media (max-width: 975px) {
  .main-content-aside-top .widget-top { margin-top: 0; }
  .top-pin {
    display: block; position: fixed; left: 0; right: 0; top: var(--nav-header-height, 50px); z-index: 990;
    padding: 0 15px; background: var(--white, #fff); box-shadow: 0 8px 20px rgba(20, 88, 221, 0.16);
    visibility: hidden; opacity: 0; pointer-events: none;
  }
  .top-pin.is-visible { visibility: visible; opacity: 1; pointer-events: auto; }
  .top-pin .widget-top { display: flex; margin: 0; box-shadow: none; border-radius: 0; }
  .top-pin .widget-top .widget-row:last-child { border-bottom: 0; }
  .top-pin .widget-top .widget-row { flex-wrap: nowrap; gap: 8px; padding: 9px 8px; }
  .top-pin .widget-top .widget-row .widget-exchanges--info { flex: 1 1 auto; min-width: 0; }
  .top-pin .widget-top .widget-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-pin .widget-row--actions { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; }
  .top-pin .widget-row--actions .btn { width: auto; min-height: 36px; }
  .top-pin .widget-row--actions .btn-shine { flex: 0 0 auto; min-width: 100px; padding-left: 10px; padding-right: 10px; }
  .top-pin .rating-stars-block { flex-wrap: nowrap; white-space: nowrap; }
  html { scroll-padding-top: calc(var(--nav-header-height, 50px) + var(--top-pin-height, 0px) + 10px); }
}
@media (max-width: 379px) {
  .top-pin .widget-top .widget-row { gap: 6px; padding: 9px 4px; }
  .top-pin .widget-top .widget-row .widget-exchanges--info { gap: 6px; }
  .top-pin .widget-top--pic figure { width: 40px; height: 40px; }
  .top-pin .widget-top .widget-item-title { font-size: 15px; }
  .top-pin .rating-stars { --star-size: 14px; --star-gap: 1px; }
  .top-pin .btn.btn-arrow { width: 34px; min-width: 34px; }
  .top-pin .widget-row--actions .btn-shine { min-width: 96px; padding-left: 8px; padding-right: 8px; font-size: 12px; }
}
@media (max-width: 359px) {
  :is(.top-pin, .main-content-aside-top) .widget-top .widget-row { flex-wrap: nowrap; gap: 6px; padding: 10px 4px; }
  :is(.top-pin, .main-content-aside-top) .widget-top .widget-row .widget-exchanges--info { flex: 1 1 auto; gap: 6px; }
  :is(.top-pin, .main-content-aside-top) .widget-top--pic { margin-left: 10px; }
  :is(.top-pin, .main-content-aside-top) .widget-top--pic figure { width: 38px; height: 38px; }
  :is(.top-pin, .main-content-aside-top) .widget-top .widget-item-title { font-size: 14px; }
  :is(.top-pin, .main-content-aside-top) .rating-stars { --star-size: 13px; --star-gap: 1px; }
  :is(.top-pin, .main-content-aside-top) .widget-row--actions .btn { padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .top-pin .widget-row--actions { gap: 5px; }
  .top-pin .btn.btn-arrow { width: 32px; min-width: 32px; }
  .top-pin .widget-row--actions .btn-shine { min-width: 92px; padding-left: 6px; padding-right: 6px; }
  .main-content-aside-top .widget-row--actions { flex: 0 0 96px; }
  .top-traders .top-traders--item .top-traders--actions .btn { font-size: 10px; letter-spacing: -0.2px; }
}

@media (max-width: 975px) {
  .top-traders--title { font-size: 18px; }
  .top-traders { padding: 18px 8px 12px; }
  .top-traders--head { margin-bottom: 16px; }
  .top-traders--list { gap: 6px; }
  .top-traders--item { align-items: center; gap: 8px; padding: 12px 6px 8px; border-radius: 12px; text-align: center; }
  .top-traders--item:hover { transform: none; }
  .top-traders--place { top: 5px; right: 5px; }
  .top-traders .place-cup { --cup-size: 26px; }
  .top-traders--avatar { width: 44px; height: 44px; }
  .top-traders--info { align-items: center; gap: 5px; }
  .top-traders .top-traders--name { font-size: 13px; line-height: 1.25; }
  .top-traders .rating-stars-block { justify-content: center; gap: 3px; }
  .top-traders .rating-stars { --star-size: 11px; --star-gap: 1px; }
  .top-traders .rating-stars--value { font-size: 12px; }
  .top-traders .status-plate { margin-top: 2px; padding: 3px 8px; font-size: 11px; gap: 0; }
  .top-traders .status-plate::before { display: none; }
  .top-traders--actions { gap: 12px; padding-top: 2px; }
  .top-traders .top-traders--actions .btn { min-height: 32px; padding: 5px 2px; font-size: 11px; border-radius: 6px; }
  .top-traders .btn-emoji { display: none; }
  .top-traders .btn-reviews-new .btn-reviews--new { top: -8px; right: -3px; padding: 1px 5px; font-size: 8.5px; }
  .better-project { padding: 16px 14px 18px; }
  .better-project--body { grid-template-columns: 84px minmax(0, 1fr); align-items: start; }
  .better-project--pic { width: 84px; height: 84px; }
  .better-project--title { font-size: 18px; }
  .better-project--duel { grid-column: 1 / -1; }
  .better-project--side { flex: 1 1 0; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .btn.btn-shine, .btn-reviews--new, .widget-head--star, .widget-head-gold .widget-head--text::before,
  .top-traders::before, .top-traders--star, .top-traders--title-text, .top-traders--item,
  .negative-hint, .negative-hint::after, .better-project--arrow, .better-project--side,
  .review-fab--btn::before, .review-fab--btn::after, .review-fab .review-fab--btn .icon, .review-fab--bubble {
    animation: none !important;
  }
  .review-fab--btn::before, .review-fab--btn::after { display: none; }
  .negative-hint::after { display: none; }
  .top-traders--item { transition: none; }
}
