/* =========================================================
   DRAG2 — ANIMATED RANKING BALLOT
   ========================================================= */


/* =========================================================
   PAGE
   ========================================================= */

.drb2-article {
  max-width: 980px;
  margin: 0 auto;
}

.drb2-read {
  max-width: 680px;
  margin: 0 auto;
}

.drb2-instructions {
  margin-bottom: 1.2rem;
}

.drb2-instructions p {
  margin-bottom: 0.35rem;
}

.drb2-credit {
  margin: 1rem 0 1.35rem;
  padding: 0.7rem 0.85rem;

  background: #f5f6f7;

  font-size: 0.9rem;
  line-height: 1.45;
}

.drb2-credit a {
  color: var(--navy);
}


/* =========================================================
   CONTROLS
   ========================================================= */

.drb2-top-controls,
.drb2-status {
  width: 520px;
  max-width: 100%;
}

.drb2-top-controls {
  margin: 0 0 5px;
}

.drb2-reset,
.drb2-submit {
  appearance: none;

  border: 1px solid #8d949b;
  border-radius: 3px;

  background: #ffffff;
  color: #343a40;

  padding: 5px 9px;

  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.69rem;

  cursor: pointer;
}

.drb2-reset {
  position: absolute;
top: auto;
bottom: 30px;
left: 22px;

  right: auto;
  border: 1px solid #6686aa;
  border-radius: 7px;

  background: #ffffff;
  color: #315f91;

  padding: 6px 10px;

  font-size: 0.70rem;
  font-weight: 600;
}

.drb2-submit {
  display: block;

  margin: 22px auto 0;

  border: none;
  border-radius: 9px;

  background: #2856b6;
  color: #ffffff !important;

  padding: 10px 24px;

  font-size: 0.88rem;
  font-weight: 600;
}


.drb2-reset:hover {
  background: #f1f2f3;
}

.drb2-submit:hover {
  background: #c62828;
}

.drb2-submit {
  color: #777;
}

.drb2-status {
  min-height: 1.1em;
  margin: 5px 0 1rem;

  font-size: 0.72rem;
  color: var(--muted);
}


/* =========================================================
   BALLOT + SUBMIT
   ========================================================= */

.drb2-ballot-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;

  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.drb2-submit-side {
  display: flex;
  align-items: center;

  padding-bottom: 4px;
}


/* =========================================================
   BALLOT
   ========================================================= */

.drb2-ballot {
  position: relative;
  
  width: 460px;
  max-width: 100%;

  padding: 28px 36px 30px;

  background: #eef5ff;

  border: 1px solid #c4d7ef;
  border-radius: 22px;

  font-family: Arial, Helvetica, sans-serif;

  user-select: none;
}

.drb2-ballot-title {
  max-width: none;
  white-space: nowrap;
  margin: 28px auto 12px;

  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.2;

  text-align: center;

  color: #173f73;
}

.drb2-ballot-instructions {
  margin: 26px auto 8px;

  text-align: center;

  color: #173f73;
}

.drb2-drag-instruction {
  font-size: 0.90rem;
  font-weight: 700;
  line-height: 1.15;
}

.drb2-scale-instruction {
  margin-top: 2px;

  font-size: 0.77rem;
  font-weight: 400;
  line-height: 1.15;
}

.drb2-indifference-instruction {
  margin: -7px auto 8px;

  font-size: 0.77rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.15;

  text-align: center;
  color: #173f73;
}
.drb2-equal-note {
  max-width: 260px;

  margin: 9px auto 0;

  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;

  text-align: center;

  color: #414b56;
}

.drb2-equal-note {
  max-width: 260px;

  margin: 9px auto 0;

  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;

  text-align: center;

  color: #414b56;
}


/* =========================================================
   FIXED RANKING STAGE

   The JS will calculate the exact height from N candidates.
   The outer stage itself does NOT resize as ranks change.
   ========================================================= */

.drb2-stage {
  position: relative;

  width: 330px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-top: -12px;

transform: translateX(-17px);

  overflow: visible;

  touch-action: none;
}

/* =========================================================
   RANK

   Rank number is OUTSIDE the blue bubble.
   ========================================================= */

.drb2-rank {
  position: absolute;

  left: 0;
  right: 0;

width: 283px;
margin-left: auto;
margin-right: auto;


  display: grid;

grid-template-columns:
  27px
  250px;

  column-gap: 6px;

  align-items: center;

  /*
    JS changes translateY and height.

    These transitions give us the slow, respectable
    movement when another rank makes room.
  */
  transition:
    transform 180ms ease-out,
    height 180ms ease-out;
}

.drb2-rank-number {
  width: 28px;
  height: 28px;

  display: flex;
  align-items: center;
  justify-content: center;

  justify-self: end;

  border-radius: 50%;

  background: #2856b6;
  color: #ffffff;

  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;

  text-align: center;
}

/* =========================================================
   RANK BUBBLE
   ========================================================= */

.drb2-rank-bubble {
  position: relative;

  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  justify-content: space-evenly;

  padding: 5px 9px;

  background: #ffffff;

  border: 2px solid #6686aa;
  border-radius: 14px;

  box-shadow:
    0 1px 2px rgba(31, 54, 78, 0.08);

  transition:
    height 180ms ease-out,
    border-color 140ms ease-out,
    background-color 140ms ease-out,
    box-shadow 140ms ease-out;
}


/*
  Candidate would join this existing rank
  if released now.
*/

.drb2-rank.drb2-join-preview
.drb2-rank-bubble {
  border-color: #315f91;
  background: #f7faff;

  box-shadow:
    0 0 0 2px rgba(49, 95, 145, 0.12);
}


/*
  Temporary new rank created by the drag preview.
*/

.drb2-rank.drb2-preview-rank
.drb2-rank-bubble {
  border-color: #4975a5;
  background: #f8fbff;
}


/* =========================================================
   CANDIDATES
   ========================================================= */

.drb2-candidate {
  position: relative;

  display: flex;
  align-items: center;

  min-height: 18px;

  padding: 1px 3px;

  font-size: 0.70rem;
  font-weight: 700;
  line-height: 1.08;

  color: #173f73;

  cursor: grab;

  touch-action: none;
}

.drb2-candidate:hover {
  background: #eef4fa;

  border-radius: 4px;
}

.drb2-candidate:active {
  cursor: grabbing;
}


/*
  Small visual cue only.

  The WHOLE candidate remains draggable.
*/

.drb2-drag-cue {
  flex: 0 0 15px;

  margin-right: 4px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 1px;
}

.drb2-triangle-up,
.drb2-triangle-down {
  width: 0;
  height: 0;

  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.drb2-triangle-up {
  border-bottom: 6px solid #2856b6;
}

.drb2-triangle-down {
  border-top: 6px solid #2856b6;
}


/*
  Original candidate becomes invisible while its
  draggable copy is following the pointer.
*/

.drb2-candidate.drb2-drag-source {
  visibility: hidden;
}


/* =========================================================
   DRAGGED CANDIDATE

   X stays fixed.
   Only Y follows the pointer.
   ========================================================= */

.drb2-drag-proxy {
  position: fixed;

  z-index: 99999;

  pointer-events: none;

  display: flex;
  align-items: center;

  min-height: 18px;

  padding: 2px 5px;

  background: #ffffff;

  border: 2px solid #4975a5;
  border-radius: 10px;

  box-shadow:
    0 3px 8px rgba(31, 54, 78, 0.20);

  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.70rem;
  font-weight: 700;
  line-height: 1.08;

  color: #263b52;

  white-space: nowrap;

  /*
    X is deliberately not animated.
    JS will control the final snap animation.
  */
}


/* =========================================================
   ENDPOINT LABELS
   ========================================================= */

.drb2-endpoint {
  position: absolute;

  left: 33px;

  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;

  letter-spacing: 0.025em;

  color: #455d77;

  pointer-events: none;
}


/* =========================================================
   FINAL MOBILE OVERRIDES
   Desktop remains unchanged.
   ========================================================= */

@media (max-width: 500px) {

  .drb2-ballot-row {
    position: static;
    left: auto;
    transform: none;

    display: block;

    width: 100%;
    max-width: 100%;
  }

  .drb2-ballot {
    width: 100%;
    max-width: 100%;

    box-sizing: border-box;

    padding-left: 18px;
    padding-right: 18px;
  }

  .drb2-stage {
    width: 100%;
    max-width: 100%;

    transform: none;
  }

  .drb2-rank {
    width: calc(100% - 20px);
  }

}

.drb2-proxy-candidate-only .drb2-rank-number {
  visibility: hidden !important;
}

.drb2-proxy-candidate-only .drb2-rank-bubble {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.drb2-proxy-candidate-only .drb2-candidate {
  color: #c62828 !important;
  background: transparent !important;
}

.drb2-proxy-candidate-only .drb2-triangle-up {
  border-bottom-color: #c62828 !important;
}

.drb2-proxy-candidate-only .drb2-triangle-down {
  border-top-color: #c62828 !important;
}

.drb2-candidate.drb2-selected-candidate {
  color: #c62828 !important;
}

.drb2-candidate.drb2-selected-candidate
.drb2-triangle-up {
  border-bottom-color: #c62828 !important;
}

.drb2-candidate.drb2-selected-candidate
.drb2-triangle-down {
  border-top-color: #c62828 !important;
}


/* =========================================================
   FLOATING NEW-RANK LANDING PREVIEW
   Red indicates the candidate would create a new rank.
   ========================================================= */

.drb2-proxy-gap .drb2-rank-number {
  background: #c62828;
}

.drb2-proxy-gap .drb2-rank-bubble {
  border-color: #c62828;
}

.drb2-proxy-gap .drb2-candidate {
  color: #c62828;
}

.drb2-proxy-gap .drb2-triangle-up {
  border-bottom-color: #c62828;
}

.drb2-proxy-gap .drb2-triangle-down {
  border-top-color: #c62828;
}

/* =========================================================
   ALL-EQUAL LANDING ZONE PROMPTS
   Shown only while every candidate shares one rank.
   ========================================================= */

.drb2-stage.drb2-all-equal::before,
.drb2-stage.drb2-all-equal::after {
  position: absolute;

  left: 50%;
  transform: translateX(-50%);

  width: 210px;

  text-align: center;

  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;

  opacity: 0.62;

  pointer-events: none;
}

.drb2-stage.drb2-all-equal::before {
  content: "Drag more favored candidates here";

  top: 62px;

  color: #2f6b4f;
}

.drb2-stage.drb2-all-equal::after {
  content: "Drag less favored candidates here";

  bottom: 62px;

  color: #9a4b4b;
}


/* =========================================================
   RANKED BALLOT ENDPOINT LABELS
   Shown after the voter creates more than one rank.
   ========================================================= */

.drb2-stage.drb2-ranked::before,
.drb2-stage.drb2-ranked::after {
  position: absolute;

  left: 50%;
  transform: translateX(-50%);

  width: 200px;

  text-align: center;

  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;

  opacity: 0.62;

  pointer-events: none;
}

.drb2-stage.drb2-ranked::before {
  content: "Most Favored";

  top: var(--drb2-most-y);

  color: #2f6b4f;
}

.drb2-stage.drb2-ranked::after {
  content: "Least Favored";

  top: var(--drb2-least-y);

  color: #9a4b4b;
}

/* =========================================================
   BALLOT HEADER / INSTRUCTION POLISH
   ========================================================= */

.drb2-main-title {
  margin: 0 auto 0;

  text-align: center;

  font-size: 1.34rem;
  font-weight: 700;
  line-height: 1.15;

  color: #173f73;
}

.drb2-ballot-title {
  margin-top: 18px;
  margin-bottom: 0;

  text-align: center;

  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.2;

  color: #173f73;
}

.drb2-direction {
  margin-top: 2px;

  text-align: center;
}

.drb2-equal-note {
  width: max-content;
  max-width: none;

  margin: 5px auto 0;

  text-align: center;
  white-space: nowrap;

  font-size: 0.78rem;
  font-weight: 600;
  font-style: normal;
  line-height: 1.15;

  color: #173f73;
}



/* Center ballot on full article width */
.drb2-ballot-row {
  position: relative;
  left: 50%;
  transform: translateX(-50%);

  width: 980px;
  max-width: none;

  justify-content: center;
}

/* =========================================================
   NEXT BUTTON HOVER
   ========================================================= */

.drb2-next:hover {
  background: #c62828;
  color: #ffffff;
  border-color: #c62828;
}


/* =========================================================
   REVIEW PAPER
   ========================================================= */

.drb2-review {
  font-family: Arial, Helvetica, sans-serif;
  color: #173f73;
}

.drb2-review-ranks {
  width: 100%;
}

.drb2-review-paper {
  width: 340px;
  max-width: 100%;

  margin: 0 auto;

  padding: 22px 24px 24px;

  background: #ffffff;

  border: 1px solid #c4d7ef;
  border-radius: 10px;

  box-shadow:
    0 1px 3px rgba(31, 54, 78, 0.10);
}

.drb2-review-paper-title {
  text-align: center;

  font-size: 1.00rem;
  font-weight: 700;
  line-height: 1.2;

  color: #173f73;
}

.drb2-review-paper-subtitle {
  width: 100%;

  margin-top: 20px;
  margin-bottom: 12px;

padding-left: 0px;
box-sizing: border-box;

  text-align: center;

  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;

  color: #173f73;
}

/* =========================================================
   REVIEW RANK GROUPS
   ========================================================= */

.drb2-review-list {
  width: 100%;
}

.drb2-review-group {
  display: grid;

  grid-template-columns:
    58px
    1fr;

  column-gap: 8px;

  margin-bottom: 4px;
}

.drb2-review-group:last-child {
  margin-bottom: 0;
}

.drb2-review-rank {
  padding-top: 1px;

  text-align: right;

  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;

  color: #2856b6;
}

.drb2-review-group-body {
  padding-left: 10px;

  border-left: 2px solid #6686aa;
}

.drb2-review-candidate {
  margin-bottom: 4px;

  text-align: left;

  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;

  color: #173f73;
}

.drb2-review-candidate:last-child {
  margin-bottom: 0;
}


/* =========================================================
   REVIEW WARNING + BUTTONS
   ========================================================= */

.drb2-not-submitted {
  margin: 18px auto 14px;

  text-align: center;

  font-size: 0.82rem;
  font-weight: 700;

  color: #9a4b4b;
}

.drb2-review-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  
  margin-top: 20px;
}

.drb2-review-back,
.drb2-review-submit {
  appearance: none;

  border-radius: 8px;

  padding: 8px 16px;

  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;

  cursor: pointer;
}

.drb2-review-back {
  border: 1px solid #6686aa;

  background: #ffffff;
  color: #315f91;
}

.drb2-review-submit {
  border: none;

  background: #2856b6;
  color: #ffffff;
}

.drb2-review-submit:hover {
  background: #c62828;
}

/* =========================================================
   REVIEW ENDPOINT LABELS
   ========================================================= */

.drb2-review-endpoint {
  padding-left: 15px;

  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.drb2-review-most {
  margin-bottom: 5px;

  color: #6f9d89;
}

.drb2-review-least {
  margin-top: 5px;

  color: #bd7f7f;
}

.drb2-review-equal-message {
  padding-left: 42px;
  margin-bottom: 6px;

  text-align: left;

  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;

  color: #9a4b4b;
}

/* =========================================================
   EQUAL-RANK REASSURANCE
   ========================================================= */

.drb2-equal-impact {
  margin-top: 4px;

  text-align: center;

  font-size: 0.80rem;
  font-weight: 400;
  line-height: 1.2;

  color: #173f73;
}


/* =========================================================
   FINAL MOBILE LAYOUT OVERRIDES
   Must remain at end of file.
   Desktop is unaffected.
   ========================================================= */

@media (max-width: 500px) {

  .drb2-ballot-row {
    position: static;
    left: auto;
    transform: none;

    display: block;

    width: 100%;
    max-width: 100%;

    margin: 0 auto;
  }

  .drb2-ballot {
    width: 100%;
    max-width: 100%;

    box-sizing: border-box;

    padding-left: 18px;
    padding-right: 18px;
  }

  .drb2-stage {
    width: 100%;
    max-width: 100%;

    transform: none;
  }

  .drb2-rank {
    width: calc(100% - 20px);
  }

  .drb2-candidate {
    font-size: 0.84rem;
  }

  .drb2-ballot-title {
    font-size: 0.92rem;
    white-space: nowrap;
  }

}


@media (max-width: 500px) and (orientation: portrait) {

  .drb2-main-title {
    font-size: 1.10rem;
  }

}


@media (max-width: 900px) {

  .drb2-direction {
    font-size: 0.82rem;
  }

}