/* 결과 화면 (docs/디자인기준.md 5장 "결과") */

.result-main {
  padding-bottom: var(--gap-block-wide);
}

/* 기준과 입력값 */
.result-basis {
  margin-top: var(--gap-block);
  font-size: var(--text-sub);
  color: var(--sub);
}

/* 큰 문장. 내 숫자 부분만 강조색입니다. */
.result-headline {
  margin-top: var(--gap-small);
  font-size: var(--text-result);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-result);
  letter-spacing: var(--tracking-tight);
  word-break: keep-all;
}

.result-headline .accent {
  color: var(--accent);
}

/* 상위 %와 한 줄 요약: "상위 9.8% · 열 명 중 한 명 안에 드는 수준이에요" */
.result-summary {
  margin-top: var(--gap-small);
}

/* 위치 막대: 왼쪽 끝이 100번째, 오른쪽 끝이 1번째. 내 위치는 --position으로 받습니다. */
.rank-bar {
  margin-top: var(--gap-block);
}

.rank-bar-track {
  position: relative;
  height: var(--bar-height);
  /* 점 위의 "나" 글자가 들어갈 자리를 비워 둡니다. */
  margin-top: calc(var(--text-desc) * var(--leading-body) + var(--bar-dot) / 2 + var(--gap-small) / 2);
  border-radius: var(--bar-radius);
  background: var(--line);
}

.rank-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--position);
  border-radius: var(--bar-radius);
  background: var(--ink);
}

/* 점이 막대 밖으로 나가지 않게 양 끝에서는 점의 반지름만큼 안쪽에 둡니다. */
.rank-bar-dot {
  position: absolute;
  top: 50%;
  left: clamp(calc(var(--bar-dot) / 2), var(--position), calc(100% - var(--bar-dot) / 2));
  width: var(--bar-dot);
  height: var(--bar-dot);
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.rank-bar-me {
  position: absolute;
  bottom: calc(100% + var(--gap-small) / 2);
  left: 50%;
  font-size: var(--text-desc);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  transform: translateX(-50%);
}

.rank-bar-scale {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: calc(var(--bar-dot) / 2 + var(--gap-small) / 2);
  font-size: var(--text-note);
  color: var(--sub);
}

.rank-bar-scale span:nth-child(2) {
  text-align: center;
}

.rank-bar-scale span:nth-child(3) {
  text-align: right;
}

/* 비교 줄 */
.compare {
  margin-top: var(--gap-block-wide);
}

.compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-item);
  min-height: var(--info-row-min-height);
  border-top: var(--hairline) solid var(--line);
}

.compare-label {
  font-size: var(--text-sub);
  color: var(--sub);
}

.compare-value {
  font-weight: var(--weight-semibold);
  text-align: right;
}

/* 목표: 비교 줄에 이어지는 한 줄. 누르면 고를 수 있는 목표가 아래에 나옵니다. */
.goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-item);
  min-height: var(--info-row-min-height);
  border-top: var(--hairline) solid var(--line);
}

.goal-row .text-button {
  flex: none;
}

/* 비교 줄이 하나도 없을 때(지난 기록도, 가운데 값도 없을 때)는 막대와 목표 사이를 띄웁니다. */
.rank-bar + .goal {
  margin-top: var(--gap-block-wide);
}

/* "목표 정하기": 누르는 곳임을 알 수 있게 강조색 글자와 화살표(›)를 붙입니다.
   15px 글자라서 큰 글자용 --accent가 아니라 작은 글자용 --accent-strong을 씁니다. */
.goal-toggle {
  gap: calc(var(--gap-small) / 4);
  color: var(--accent-strong);
}

.goal-toggle .icon svg {
  width: var(--icon-small);
  height: var(--icon-small);
}

/* 목표 고르기가 열려 있으면 화살표가 아래를 봅니다. */
.goal-toggle[aria-expanded='true'] .icon {
  transform: rotate(90deg);
}

.goal-label {
  font-size: var(--text-sub);
  color: var(--sub);
}

.goal-text {
  padding: var(--gap-small) 0;
  font-weight: var(--weight-semibold);
}

.goal-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-small);
  padding-bottom: var(--gap-small);
}

/* 재미있는 한마디: 이 화면에서 상자를 쓰는 곳은 여기뿐입니다.
   상자만 있으면 입력칸처럼 보여서 위에 작은 이름표("쉽게 말하면")를 붙입니다. */
.fun {
  margin-top: var(--gap-block);
}

.fun-label {
  font-size: var(--text-desc);
  color: var(--sub);
}

.fun-line {
  margin-top: var(--gap-small);
  padding: var(--gap-item);
  border-radius: var(--radius-box);
  background: var(--fill);
  font-size: var(--text-sub);
  font-weight: var(--weight-medium);
}

/* 출처 */
.source {
  margin-top: var(--gap-block);
  font-size: var(--text-note);
  color: var(--sub);
}

.source a {
  text-decoration: underline;
}

.source-note {
  margin-top: calc(var(--gap-small) / 2);
  font-size: var(--text-note);
  color: var(--sub);
}

/* 아래쪽 버튼과 그 결과 안내 */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--gap-small);
  margin-top: var(--gap-block-wide);
}

.result-status {
  min-height: calc(var(--text-desc) * var(--leading-body));
  font-size: var(--text-desc);
  color: var(--sub);
}
