/* ===== RP SEO Calculator (ONE FILE CSS) ===== */
.rp-seo-calc, .rp-seo-calc * { box-sizing: border-box; }
.rp-seo-calc{
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
  color:#1a1a1a;
  overflow-x:hidden; /* 1) стоп горизонтальному скроллу */
}

.rp-seo-calc-wrap{
  max-width: 1500px;     /* шире (было 980) */
  margin: 24px auto;
  padding: 0 16px;
}

.rp-seo-card{
  background:#fff;
  border-radius:14px;
  box-shadow:0 10px 30px rgba(0,0,0,.08);
  border:1px solid rgba(229,231,235,.9);
  overflow:hidden;
  max-width:100%;
}

.rp-seo-head{
  padding:22px 22px 16px;
  background:linear-gradient(135deg, rgba(102,126,234,.10) 0%, rgba(118,75,162,.08) 100%);
  border-bottom:1px solid rgba(229,231,235,.9);
}

.rp-seo-title{
  margin:0;
  font-size:20px;
  font-weight:800;
  letter-spacing:-.25px;
}

.rp-seo-subtitle{
  margin:8px 0 0;
  color:#4a5568;
  font-size:14px;
  line-height:1.5;
}

.rp-seo-body{
  padding:22px;
  display:grid;
  grid-template-columns: 1.3fr .9fr;
  gap:18px;
  min-width:0; /* важно для grid */
}

.rp-field{ display:flex; flex-direction:column; gap:8px; min-width:0; }
.rp-label{ font-size:13px; font-weight:600; color:#1f2937; }

.rp-select, .rp-input{
  width:100%;
  border:1px solid #e5e7eb;
  background:#fff;
  border-radius:10px;
  padding:12px 12px;
  font-size:15px;
  outline:none;
  min-width:0;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.rp-select:focus, .rp-input:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.rp-inline{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  min-width:0;
}

/* Option blocks */
.rp-options{
  display:grid;
  gap:10px;
  padding:12px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background: rgba(249,250,251,.65);
  min-width:0;
}

.rp-radio{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px 10px;
  border-radius:10px;
  background:#fff;
  border:1px solid rgba(229,231,235,.9);
  min-width:0;
}
.rp-radio input{ margin-top:2px; }

/* Regions */
.rp-region-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  min-width:0;
}

.rp-region{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:12px;
  border-radius:12px;
  background:#fff;
  border:1px solid rgba(229,231,235,.95);
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-width:0;
}
.rp-region:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,.06);
  border-color: rgba(102,126,234,.35);
}
.rp-region input{ margin-top:2px; }

.rp-region-other{ display:none; margin-top:8px; }
.rp-region-other.show{ display:block; }

/* Links */
.rp-links-box{
  border:1px solid rgba(229,231,235,.9);
  border-radius:12px;
  padding:14px;
  background:#fff;
  display:grid;
  gap:10px;
}
.rp-links-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.rp-links-level{
  font-weight:800;
  font-size:15px;
  letter-spacing:-.2px;
  color:#111827;
}
.rp-links-amount{
  margin-top:4px;
  font-size:14px;
  font-weight:800;
  color:#2563eb;
}
.rp-links-hint{
  font-size:12.5px;
  color:#4a5568;
  line-height:1.45;
  text-align:right;
  max-width: 55%;
}
input[type="range"].rp-range{ width:100%; accent-color:#667eea; }
.rp-links-scale{
  display:flex;
  justify-content:space-between;
  font-size:12px;
  color:#6b7280;
}

/* Summary */
.rp-summary{
  border:1px solid rgba(229,231,235,.9);
  border-radius:14px;
  padding:16px;
  background:#fff;
  box-shadow:0 10px 24px rgba(0,0,0,.05);
  height:fit-content;
  position: sticky;
  top: 16px;
  min-width:0;
  max-width:100%;
}

.rp-total{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:14px;
  border-radius:12px;
  background:linear-gradient(135deg,rgba(102,126,234,.12),rgba(118,75,162,.10));
  border:1px solid rgba(102,126,234,.18);
  font-size:22px;
  font-weight:900;
  letter-spacing:-.3px;

  /* критично для RU: не даём вылезать */
  flex-wrap: wrap;
  min-width:0;
  max-width:100%;
}
.rp-total > *{
  min-width:0;
  max-width:100%;
  white-space:normal;
}

.rp-actions{ margin-top:14px; display:grid; gap:10px; }

.rp-btn{
  padding:14px;
  text-align:center;
  border-radius:10px;
  background:linear-gradient(135deg,#667eea,#764ba2);
  color:#fff !important;
  text-decoration:none;
  font-weight:700;
  border:none;
  cursor:pointer;
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: 0 8px 20px rgba(102,126,234,.25);
}
.rp-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(102,126,234,.35);
}
.rp-btn.secondary{
  background:#fff;
  color:#111827 !important;
  border:1px solid rgba(229,231,235,.9);
  box-shadow:0 8px 18px rgba(0,0,0,.06);
}
.rp-btn.secondary:hover{ box-shadow:0 12px 26px rgba(0,0,0,.10); }

.rp-note{
  margin-top:12px;
  font-size:12.5px;
  color:#4a5568;
  line-height:1.5;
}

/* ===== Responsive ===== */
@media (max-width: 968px){
  .rp-seo-body{ grid-template-columns: 1fr; }

  /* на мобилке sticky часто даёт "криво" */
  .rp-summary{
    position: static !important;
    top:auto !important;
    width:100%;
  }

  .rp-links-hint{ max-width: 100%; text-align:left; }
}

@media (max-width: 680px){
  .rp-inline{ grid-template-columns: 1fr; }
  .rp-region-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 520px){
  .rp-seo-calc-wrap{ padding: 0 12px; }
  .rp-seo-body{ padding: 16px; }

  /* RU/UA: итог делаем колонкой — не ломается вообще */
  .rp-total{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }
  .rp-total span:first-child{
    font-size: 18px;
    line-height: 1.2;
  }
  .rp-total .rp-total-el{
    font-size: 28px;
    line-height: 1.1;
    word-break: break-word;
  }

  .rp-actions{ width:100%; }
  .rp-actions .rp-btn,
  .rp-actions .rp-btn.secondary{
    width:100%;
    display:block;
  }
}
