/* 이름 궁합 테스트만 쓰는 모양. 색은 공통 변수를 쓴다(어두운 화면 자동). */
.nm-form {
  margin-top: 22px;
}
.nm-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}
.nm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.nm-field > span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}
.nm-field input {
  appearance: none;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 1.2rem; /* 16px 이상: 아이폰에서 누를 때 화면이 확대되지 않게 */
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.nm-field input::placeholder {
  color: var(--muted);
  font-weight: 500;
  opacity: 0.7;
}
.nm-field input:focus {
  border-color: #ec4899;
  background: var(--surface);
}
.nm-field input[aria-invalid='true'] {
  border-color: var(--wait);
}
.nm-heart {
  font-size: 1.6rem;
  line-height: 1;
  padding-bottom: 14px;
  user-select: none;
}
.nm-err {
  color: var(--wait);
  font-size: 0.86rem;
  font-weight: 600;
  margin: 10px 0 0;
  text-align: center;
}
.nm-go {
  display: block;
  width: 100%;
  margin-top: 16px;
  min-height: 54px;
  font-size: 1.08rem;
  background: linear-gradient(135deg, #f472b6, #db2777);
  color: #fff;
  touch-action: manipulation;
}
.nm-go:disabled {
  opacity: 0.6;
  cursor: wait;
}
.nm-safe {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

/* 계산 과정(피라미드) */
.nm-work {
  margin-top: 18px;
  scroll-margin-top: 80px;
  text-align: center;
}
.nm-work-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  word-break: keep-all;
}
.nm-work .rounds {
  margin: 12px 0 16px;
}
.nm-work .chip {
  touch-action: manipulation;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nm-work .chip:disabled {
  opacity: 0.55;
  cursor: default;
}
.nm-pyramid {
  --cw: 40px;
  --gap: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  width: 100%;
}
.nm-row {
  display: flex;
  justify-content: center;
  gap: var(--gap);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s, transform 0.25s;
}
.nm-row.on {
  opacity: 1;
  transform: none;
}
.nm-cell {
  width: var(--cw);
  height: var(--cw);
  border-radius: calc(var(--cw) * 0.28);
  background: var(--surface-2);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: calc(var(--cw) * 0.46);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.nm-row.on .nm-cell {
  animation: nm-pop 0.3s calc(var(--i) * 35ms) both;
}
.nm-first .nm-cell {
  height: calc(var(--cw) * 1.55);
  gap: calc(var(--cw) * 0.08);
}
.nm-first .nm-ch {
  font-size: calc(var(--cw) * 0.5);
}
.nm-first .nm-num {
  font-size: calc(var(--cw) * 0.32);
  color: var(--muted);
  font-weight: 700;
}
/* 두 사람 글자를 색과 밑줄 모양으로 함께 구분한다(색만으로 가르지 않게) */
.nm-cell.nm-a {
  background: color-mix(in srgb, #ec4899 16%, var(--surface));
  box-shadow: inset 0 -3px 0 #ec4899;
}
.nm-cell.nm-b {
  background: color-mix(in srgb, #6366f1 16%, var(--surface));
  box-shadow: inset 0 -3px 0 #6366f1, inset 0 3px 0 color-mix(in srgb, #6366f1 40%, transparent);
}
.nm-last .nm-cell {
  width: calc(var(--cw) * 1.3);
  height: calc(var(--cw) * 1.3);
  background: linear-gradient(135deg, #f472b6, #db2777);
  color: #fff;
  font-size: calc(var(--cw) * 0.7);
}
.nm-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.nm-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 4px;
}
.nm-legend .la {
  background: color-mix(in srgb, #ec4899 16%, var(--surface));
  box-shadow: inset 0 -3px 0 #ec4899;
}
.nm-legend .lb {
  background: color-mix(in srgb, #6366f1 16%, var(--surface));
  box-shadow: inset 0 -3px 0 #6366f1;
}
.nm-note {
  margin: 8px 0 0;
  word-break: keep-all;
}
@keyframes nm-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* 결과 */
.nm-names {
  margin: 6px 0 0;
  font-weight: 800;
  font-size: 1.05rem;
  word-break: keep-all;
}
#nm-pct {
  color: #db2777;
}
.nm-swap {
  margin: 22px 0 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
}
.nm-swap-q {
  margin: 0;
  font-weight: 800;
}
.nm-swap-pct {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}
.nm-swap .fine {
  margin: 0;
  word-break: keep-all;
}

/* 설명 글 속 획수표 */
.nm-jamo {
  margin: 12px 0 6px;
}
.nm-jamo table {
  font-size: 0.92rem;
}
.nm-jamo td,
.nm-jamo th {
  padding: 8px 6px;
  text-align: center;
}
.nm-jamo td strong {
  font-size: 1.15rem;
}
.nm-jamo th[scope='row'] {
  text-align: left;
  white-space: nowrap;
}
.nm-example {
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.95rem;
  line-height: 1.8;
  text-align: center;
  letter-spacing: 0.25em;
  word-break: keep-all;
}
.nm-example b {
  color: #db2777;
}
.nm-example div {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .nm-row,
  .nm-row.on .nm-cell {
    animation: none;
    transition: none;
  }
}
@media (max-width: 480px) {
  /* 글자가 많을 때 칸이 너무 작아지지 않게 판 안쪽 여백을 줄인다 */
  .nm-work {
    padding: 18px 10px;
  }
}
@media (max-width: 380px) {
  .nm-fields {
    gap: 6px;
  }
  .nm-heart {
    font-size: 1.3rem;
  }
}
